NAME
report – report definition file
DESCRIPTION
Files whose names end with `.rep’ are taken as report definition files, which are used by the report generator program ubreport. Report definitions are text files and can be created and maintained by any text editor such as vi, or edit.
A report definition file consists of a standard filename declaration and report command options.
The filename declaration is a line that starts with a `:’, a space and is followed by a table name. The report command options are lines starting with a capital letter followed by a picture or special instruction to the report generator.
Lines in report pictures can be any combination of text and fields.
A picture line can also be divided into three parts left, centre, and right by using `#’ as a separator. e.g. left#centre#right. Any section can be empty and only as many `#’ as are necessary need be given. Lines are left justified by default. To centre a string use `#string’; to right align a string use `##string’ etc.
Records from an associated table can be included in a report by starting a line with `<table’. In this case all the format options for table will be used. i.e. N table, R table, S table, T table, U table, D table, C table. Note that C table will be applied to all access to table, not just format sections.
REPORT COMMAND OPTIONS
{<table>} Means apply option to table instead of the master table.
{=} Means an optional condition may be given. See CONDITIONAL FORMATS below.
OPTION | TITLE | DESCRIPTION | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | Attributes |
SYNTAX
A {<field>} <attribute> {<condition>} ... > DESCRIPTION <condition> is an expression. If it is true (or missing) the <attribute> is applied to <field>. If <field> is [record], <attribute> is applied to the entire record. If <field> is missing, <attribute> is applied to the entire picture. There may be several <attribute>/<condition> pairs for any <field>. The first true condition is used to select the attribute. |
||||||||||
B | Page Break |
SYNTAX
B{P} <field> DESCRIPTION |
||||||||||
C | Conditions |
SYNTAX
C {<table>} <expression> ... > DESCRIPTION |
||||||||||
D | Deletions |
SYNTAX
D {<table>} DESCRIPTION If table is given and there is an “R <table>” section, the records will be deleted from the table as they are printed. |
||||||||||
F | Page Footer |
SYNTAX
F{L|T} {=} <picture> > DESCRIPTION |
||||||||||
H | Page Header |
SYNTAX
H{1|T}{0} {=} <picture> > DESCRIPTION |
||||||||||
I | Variable Input |
SYNTAX
I {<title>} <field def> ... > <input screen> > DESCRIPTION <input screen> is an input screen in the same format as a master file screen. If <title> is given it is used as the window title and is centred on the top border of the window. The fields defined by field def are accessible in the table `?’. EXAMPLE I date, 6 D > REPORT DATE [date] > C [date entered] <=[?.date] > |
||||||||||
K | Report Key/Index |
SYNTAX
K <key> DESCRIPTION |
||||||||||
L | Lines Printed on Page |
SYNTAX
L <n> DESCRIPTION |
||||||||||
M | Move Records |
SYNTAX
M <table> DESCRIPTION |
||||||||||
N | New Section |
SYNTAX
N {<table>} <field> {=} <picture> > DESCRIPTION |
||||||||||
O | Match Index |
SYNTAX
O{L} <list> DESCRIPTION EXAMPLE O "Y" [order no] |
||||||||||
P | Page Length |
SYNTAX
P <n> DESCRIPTION |
||||||||||
R | Report Format |
SYNTAX
R {<table>} {=} <picture> > DESCRIPTION If the picture has `<‘ in it, the rest of the line is taken as a table name and an optional index (if there is more than one possible association). The associated records in the specified table are printed at that position using the appropriate formats. C,D,N,R,S,T and V can all be used with the included formats. Include files can also be specified as {<…<}. The table name and optional index replace … The advantage of this syntax is that it can be included inline with other parts of the picture. N.B. ‘<‘ sections can be recursive if the table structure supports recursion. e.g. Bill of Materials reporting. If the report has a `!’ in it the remainder of the line is the name of an execute (X) section. The output of the execute section is indented to the current the current position of the ‘!’. Execute sections can also be specified as {!…!}. Again this has the advantage of being inline with other things in the report. If a line in the format starts with “=”, the format up to the next “>” will only be printed if the condition following the “=” is true. IMPORTANT: To start a line with “=” (e.g. to put “=” across a page) put “\” in front of it. e.g. Parts of a line can be conditionally included by using the following syntax: {=<condition>{?<true format>{:<optional else format>=} In line conditions can be nested. EXAMPLE R ... = [margin] < 30% *** WARNING: NOT ENOUGH MARGIN *** > SOME TEXT {=[value] > 0{?MORE THAN 0{:LESS THAN OR EQUAL TO 0=} AND SOME MORE TEXT ... <table1 category,description ... SOMETHING <table2 > R table1 ... > R table2 ... > |
||||||||||
S | Sub-Totals |
SYNTAX
S{<offset>}{F} {<table>} <field> {=} {<picture>} > DESCRIPTION EXAMPLE S [supplier] -> TOTALS FOR THIS SUPPLIER: [cost] [no of recs] -> |
||||||||||
T | Report Total |
SYNTAX
T{B} {<table>} {=} {<picture>} > DESCRIPTION EXAMPLE TB \=> REPORT TOTAL: [cost] [no of recs] \=> > |
||||||||||
U | Updates |
SYNTAX
U {<table>} {=} <field> <=+-*/> <expression> ... > DESCRIPTION
EXAMPLE U [price] *1.1 [on hand] -[qty] [value] -[qty]*[price] [last sales] =[system.date] > |
||||||||||
W | Page Width |
SYNTAX
W <n> DESCRIPTION EXAMPLE W 120 |
||||||||||
X | Commands to Execute |
SYNTAX
X <name> <commands> > DESCRIPTION EXAMPLE X files 1s - 1 > R ... !files ... > |
CONDITIONAL FORMATS
Conditional Formats can be used to print records, subtotals, etc in different formats. An expression is evaluated and if it is true (non-zero) the format is used.
Example:
R [partno] [description] [qty on hand] [reorder] > R = [qty on hand] < [reorder] [part no] [description] [qty on hand] [reorder] BUY MORE > R = [qty on hand] = 0 [part no] [description] OUT OF STOCK >
The syntax is = <expression> and may be used with any command option that has {=} in its syntax.
The format conditions are evaluated from the last to the first. The first true expression becomes the format to use for this record. This means the default format (i.e. no condition) comes first in the report program file.
Conditional formats can also occur inside a format. This happens when a format line starts with “=”. Up to the next terminating “>” the format will only be printed if the expression following the “=” is true.
These conditional formats can be nested.
The third method for conditional formats is embedded in the report line. The structure
{=<condition>{?<true format>{:<optional false format>=}
can occur anywhere within a format line. It cannot extend across multiple input lines.
You can nest an embedded condition inside the true and false formats for more complex requirements.
If the false format is not needed then the ‘{:’ operator is also left out.
Example:
R [partno] [description] {=[qty on hand] > 0{?[qty on hand]{:{=[qty on hand] = 0{?OUT OF STOCK{:OVERSOLD=}=}\ {=[qty on hand] <= 0 {?[reorder]=} >