Identifiers, Operators, and Literals

This section lists the reserved key word and phrases and their usage. The supported operators are defined and the rules for referencing XML extract fields and using literals.

Key Words

There're several categories of key words and key word phrases:

  • Command and column header key words

  • Command parameter and function parameter key words

  • Field-level key words

  • Expression key words

Command and Column Header Key Words

The command and column header key words must be used in the format shown: enclosed in <>s and in all capital letters with a bold font.

  • <LEVEL> - the first entry of a data table. Associates the table with an XML element and specifies the hierarchy of the table.

  • <END LEVEL> - declares the end of the current level. Can be used at the end of a table or in a standalone table.

  • <POSITION> - column header for the first column of data field rows, which specifies the starting position of the data field in a record.

  • <LENGTH> - column header for the second column of data field rows, which specifies the length of the data field.

  • <FORMAT> - column header for the third column of data field rows, which specifies the data type and format setting.

  • <PAD> - column header for the fourth column of data field rows, which specifies the padding style and padding character.

  • <DATA> - column header for the fifth column of data field rows, which specifies the data source.

  • <COMMENT> - column header for the sixth column of data field rows, which allows for free form comments.

  • <NEW RECORD> - specifies a new record.

  • <DISPLAY CONDITION> - specifies the condition when a record should be printed.

  • <TEMPLATE TYPE> - specifies the type of the template, either FIXED_POSITION_BASED or DELIMITER_BASED.

  • <OUTPUT CHARACTER SET> - specifies the character set to be used when generating the output.

  • <NEW RECORD CHARACTER> - specifies the character(s) to use to signify the explicit and implicit new records at runtime.

  • <DEFINE LEVEL> - defines a format-specific level in the template.

  • <BASE LEVEL> - subcommand for the define level and define concatenation commands.

  • <GROUPING CRITERIA> - subcommand for the define level command.

  • <END DEFINE LEVEL> - signifies the end of a level.

  • <DEFINE SEQUENCE> - defines a record or extract element based sequence for use in the template fields.

  • <RESET AT LEVEL> - subcommand for the define sequence command.

  • <INCREMENT BASIS> - subcommand for the define sequence command.

  • <START AT> - subcommand for the define sequence command.

  • <MAXIMUM> - subcommand for the define sequence command.

  • <MINIMUM> - subcommand for the define sequence command.

  • <MAXIMUM LENGTH> - column header for the first column of data field rows, which specifies the maximum length of the data field. For DELIMITER_BASED templates only.

  • <END DEFINE SEQUENCE> - signifies the end of the sequence command.

  • <DEFINE CONCATENATION> - defines a concatenation of child level elements that can be referenced as a string in the parent level fields.

  • <ELEMENT> - subcommand for the define concatenation command.

  • <DELIMITER> - subcommand for the define concatenation command.

  • <END DEFINE CONCATENATION> - signifies the end of the define concatenation command.

  • <SORT ASCENDING> - format-specific sorting for the instances of a level.

  • <SORT DESCENDING> - format-specific sorting for the instances of a level.

  • <SORT ASCENDING NUMBER> - numeric sorting for the instances of a level.

  • <SORT DESCENDING NUMBER> - numeric sorting for the instances of a level.

Command Parameter and Function Parameter Key Words

The command parameter and function parameter key words must be entered in all capital letters, non-bold fonts.

  • PERIODIC_SEQUENCE - used in the reset at level subcommand of the define sequence command. It denotes that the sequence number is to be reset outside the template.

  • FIXED_POSITION_BASED, DELIMITER_BASED - used in the template type command, specifies the type of template.

  • RECORD, LEVEL - used in the increment basis subcommand of the define sequence command. RECORD increments the sequence each time it's used in a new record. LEVEL increments the sequence only for a new instance of the level.

Field-Level Key Words

This section gives a list of key words and specifies the data type for each.

  • Alpha - in the <FORMAT> column, specifies the data type is alphanumeric.

  • Number - in the <FORMAT> column, specifies the data type is numeric.

  • Integer - in the <FORMAT> column, used with the Number key word. Takes the integer part of the number. This has the same functionality as the INTEGER function, except the INTEGER function is used in expressions, while the Integer key word is used in the <FORMAT> column only.

  • Decimal - in the <FORMAT> column, used with the Number key word. Takes the decimal part of the number. This has the same functionality as the DECIMAL function, except the DECIMAL function is used in expressions, while the Decimal key word is used in the <FORMAT> column only.

  • Date - in the <FORMAT> column, specifies the data type is date.

  • L, R- in the <PAD> column, specifies the side of the padding (Left or Right).

Expression Key Words

Key words and phrases used in expressions must be in capital letters and bold fonts.

  • IF THEN ELSE IF THEN ELSE END IF - these key words are always used as a group. They specify the "IF" control structure expressions.

  • IS NULL, IS NOT NULL - these phrases are used in the IF control structure. They form part of boolean predicates to test if an expression is NULL or not NULL.

Operators

There're two groups of operators: the boolean test operators and the expression operators.

The boolean test operators include: "=", "<>", "<", ">", ">=", and "<=". They can be used only with the IF control structure. The expression operators include: "()", "||", "+", "-", and "*". They can be used in any expression.

The following table lists the operators and describes their usage.

Symbol Usage

=

Equal to test. Used in the IF control structure only.

<>

Not equal to test. Used in the IF control structure only.

>

Greater than test. Used in the IF control structure only.

<

Less than test. Used in the IF control structure only.

>=

Greater than or equal to test. Used in the IF control structure only.

<=

Less than or equal to test. Used in the IF control structure only.

()

Function argument and expression group delimiter. The expression group inside "()" is always be evaluated first. "()" can be nested.

|

Union operator to be used in the <LEVEL> element.

||

String concatenation operator.

+

Addition operator. Implicit type conversion may be performed if any of the operands aren't numbers.

-

Subtraction operator. Implicit type conversion may be performed if any of the operands aren't numbers.

*

Multiplication operator. Implicit type conversion may be performed if any of the operands aren't numbers.

DIV

Division operand. Implicit type conversion may be performed if any of the operands are not numbers. Note that "/" isn't used because it's part of the XPATH syntax.

IN

Equal-to-any-member-of test.

NOT IN

Negates the IN operator. Not-Equal-to-any-member-of test.

Reference to XML Extract Fields and XPATH Syntax

XML elements can be used in any expression.

At runtime XML elements are replaced with the corresponding field values. The field names are case-sensitive.

When the XML extract fields are used in the template, they must follow the XPATH syntax. This is required so that the Publisher engine can correctly interpret the XML elements.

There's always an extract element considered as the context element during the Publisher formatting process. When Publisher processes the data rows in a table, the level element of the table is the context element. For example, when Publisher processes the data rows in the Payment table, Payment is the context element. The relative XPATH you use to reference the extract elements are specified in terms of the context element.

For example to refer to the PayeeName element in a Payment data table, specify the following relative path:

Payee/PayeeInfo/PayeeName

Each layer of the XML element hierarchy is separated by a backslash "/". You use this notation for any nested elements. The relative path for the immediate child element of the level is just the element name itself. For example, you can use TransactionID element name as is in the Payment table.

To reference a parent level element in a child level table, you can use the "../" notation. For example, in the Payment table if you must reference the BatchName element, you can specify ../BatchName. The "../" provides Batch as the context; in that context you can use the BatchName element name directly as BatchName is an immediate child of Batch. This notation goes up to any level for the parent elements. For example if you must reference the RequesterParty element (in the RequestHeader) in a Payment data table, you can specify the following:

../../TrxnParties/RequesterParty

You can always use the absolute path to reference any extract element anywhere in the template. The absolute path starts with a backslash "/". For the PayeeName in the Payment table example above, you have the following absolute path: /BatchRequest/Batch/Payment/Payee/PayeeInfo/PayeeName

The absolute path syntax provides better performance.

The identifiers defined by the setup commands such as define level, define sequence and define concatenation are considered to be global. They can be used anywhere in the template. No absolute or relative path is required. The base level and reset at level for the setup commands can also be specified. Publisher can find the correct context for them.

If you use relative path syntax, then you should specify it relative to the base levels in the following commands:

  • The element subcommand of the define concatenation command

  • The grouping criteria subcommand of the define level command

The extract field reference in the start at subcommand of the define sequence command should be specified with an absolute path.

The rule to reference an extract element for the level command is the same as the rule for data fields. For example, if you have a Batch level table and a nested Payment level table, then you can specify the Payment element name as-is for the Payment table. Because the context for evaluating the Level command of the Payment table is the Batch.

However, if you skip the Payment level and you have an Invoice level table directly under the Batch table, then you must specify Payment/Invoice as the level element for the Invoice table.

The XPATH syntax required by the template is very similar to UNIX/LINUX directory syntax. The context element is equivalent to the current directory. You can specify a file relative to the current directory or you can use the absolute path which starts with a "/".

Finally, the extract field reference as the result of the grouping criteria sub-command of the define level command must be specified in single quotes. This tells the Publisher engine to use the extract fields as the grouping criteria, not their values.

Notes on Viewing eText Output from a Browser

If the report data contains Simplified Chinese characters and the <OUTPUT CHARACTER SET> is set to GBK, then the Chinese characters do not display properly in Internet Explorer 7 with gbk2312 encoding.

This issue may also occur in other non-English encodings as well, such as native Japanese and Korean. The output renders appropriately with Firefox 3.5, when setting the character set to be GBK in the eText template and setting the browser encoding to be GBK or GB2312. You can work around this issue by setting <OUTPUT CHARACTER SET> to utf-8. Note that this is a browser display issue only. The text file is generated correctly.