ReportWorkshop Overview | Template syntax | Commands

<< Click to display table of contents >>

ReportWorkshop Overview | Template syntax | Commands

See the topic about fields in templates for a general description of the syntax.

All commands are case insensitive.

The current version of Report Workshop supports commands only inside a template text. They are not supported in strings (such as data queries, hyperlink targets, item hints and checkpoints).

"IF – ENDIF" or "IF – ELSE – ENDIF"

"If" command allows excluding some content from the report result. It may be optionally followed by "Else" command, and must be finished by "EndIf" command.

All these commands must be in the same sub-document (i.e. in the same table cell)

Syntax:

<if> ::= if <if condition>

<if condition> ::= <operand> [ <comparison operation> <operand>]

<operand> ::= <full data field name>|%<variable name>|<integer constant>|<string constant>

In the first case, <if condition> is a single operand, which is evaluated as True or False.

<operand> may be either a data field or a variable. They must be defined, otherwise the command is erroneous.

For data fields having integer values, any non-zero value is evaluated as True, zero is evaluated as False.

Example:

{$IF count}Count of details: {count}{$ELSE}No details available{$ENDIF}

Variables and data fields of all other types are treated as string values.

Values evaluated as True

Values evaluated as False

t

y

true

yes

on

1

Texts.TrueText

f

n

false

no

off

0

Texts.FalseText

The second case, <if condition> consists of three parameters: <operand> <comparison operation> <operand>

Important: operands and operation must be delimited by space characters.

The command compares two operands using the specified comparison operation.

<comparison operation> ::= =|<>|<|>|<=|>=|==|!=

Comparison operation

Meaning

=

==

equal to

<>

!=

not equal to

<

less than

>

greater than

<=

less than or equal to

>=

greater than or equal to

In addition to fields and variables, operand may be a string or an integer constant.

String constant is a text inside double quotes:

<string constant> ::= "|<text>|"

To include a double quote in text, duplicate it.

Integer constant consists of digits and an optional minus sign:

<integer constant> ::= [-]<digit>+

<digit> ::= 0|1|2|3|4|5|6|7|8|9

If the field name consists only of digits, to prevent interpreting it as an integer constant, include it in single quotes.

Examples

{$IF test = "Passed"}OK{$ENDIF}
{$IF weight > 200}Too heavy{$ENDIF}

Strings comparisons are case sensitive. When a string are compared to a numeric value, the component convert this string to a numeric value before the comparison (if it is not possible, "If" command is erroneous). The conversion to a floating value uses the system default numeric separator. String value can be compared only to another string or a number (it cannot be compared to a date, for example).

"IFDEF – ENDIF" or "IFDEF – ELSE – ENDIF"

"IfDef" command is similar to "If", it has a similar syntax and meaning, but a condition is evaluated differently.

Syntax:

<ifdef> ::= ifdef <condition>

<condition> ::= <full data field name>|%<variable name>

Example:

{$IFDEF phone2}Phone 2: {phone2}{$ENDIF}

<value> may be either a data field or a variable.

A data field in the condition must exist, otherwise the command is erroneous. NULL fields (or empty string fields) are evaluated as False, any other values are evaluated as True.

For variables, non-existent or empty variables are evaluated as False, variables having non-empty text are evaluated as True.

"IFNDEF – ENDIF" or "IFNDEF – ELSE – ENDIF"

"IfNDef" command is similar to "IfDef", but the rule of condition evaluating is exactly the opposite.

Syntax:

<ifndef> ::= ifndef <condition>

<condition> ::= <full data field name>|%<variable name>

Example:

{$IFnDEF comments}No comments{$ENDIF}

"LISTRESET"

"ListReset" specifies when the paragraph numbering must be reset to 1. This command must be inserted in a numbered paragraph, otherwise it is erroneous.

Syntax:

<listreset> ::= listreset[ <depth>]

<depth> is an integer value, zero or positive. If omitted, zero is assumed.

By default, paragraph numbering is continuous through the whole document. This command allows to reset it to 1.

The depth parameter specifies the data query on which the list is reset. 0 means the most nested query, 1 means the query containing it, and so on.

Example:

Let we need to generate an organization structure. There are queries "bosses", "managers", "workers", having a master-detail relationship.

Without ListReset

{$LISTRESET 1}

{$LISTRESET} or {$LISTRESET 0}

boss A
  manager A
    1. worker A
    2. worker B
  manager B
    3. worker C
    4. worker D
boss B
  manager C
    5. worker E
    6. worker F
  manager D
    7. worker G
    8. worker H

boss A
  manager A
    1. worker A
    2. worker B
  manager B
    3. worker C
    4. worker D
boss B
  manager C
    1. worker E
    2. worker F
  manager D
    3. worker G
    4. worker H

boss A
  manager A
    1. worker A
    2. worker B
  manager B
    1. worker C
    2. worker D
boss B
  manager C
    1. worker E
    2. worker F
  manager D
    1. worker G
    2. worker H