Etext Template

Structure of eText Templates

There are two types of eText templates: fixed-position based (EFT templates) and delimiter-based (EDI templates).

The templates are composed of a series of tables. The tables define layout and setup commands and data field definitions. The required data description columns for the two types of templates vary, but the commands and functions available are the same. A table can contain just commands, or it can contain commands and data fields.

Commands that apply globally, or commands that define program elements for the template, are "setup" commands. These must be specified in the initial tables of the template. Examples of setup commands are Template Type and Character Set.

Expressions

Expressions are classified into the following three categories:

  • Boolean Expression - an expression that returns a boolean value, either true or false. This kind of expression can be used only in the IF-THEN-ELSE control structure and the parameter of the display condition command.

  • Numeric Expression - an expression that returns a number. This kind of expression can be used in numeric data fields. It can also be used in functions and commands that require numeric parameters.

  • Character Expression - an expression that returns an alphanumeric string. This kind of expression can be used in string data fields (format type Alpha). They can also be used in functions and command that require string parameters.

Control Structures

The only supported control structure is IF-THEN-ELSE. It can be used in an expression.

The syntax is:

IF <boolean_expressionA> THEN
   <numeric or character expression1>
[ELSIF <boolean_expressionB THEN
   <numeric or character expression2>]
...
[ELSE
   <numeric or character expression3]
END IF

IF PaymentAmount/Currency/Code IN ('USD', 'EUR', 'AON', 'AZM') THEN      
   PayeeAccount/FundsCaptureOrder/OrderAmount/Value * 100   
ELSIF PaymentAmount/Currency/Code IN ('BHD', 'IQD', 'KWD') THEN      
   PayeeAccount/FundsCaptureOrder/OrderAmount/Value * 1000   
ELSE      
   PayeeAccount/FundsCaptureOrder/OrderAmount/Value   
END IF; 

Functions

Here is the list of supported functions.

  • SEQUENCE_NUMBER - is a record element index. It is used in conjunction with the Define Sequence command. It has one parameter, which is the sequence defined by the Define Sequence command. At runtime it increases its sequence value by one each time it is referenced in a record.

  • COUNT - counts the child level extract instances or child level records of a specific type. Declare the COUNT function on a level above the entity to be counted. The function has one argument. If the argument is a level, then the function counts all the instances of the (child) level belonging to the current (parent) level instance.

    For example, if the level to be counted is Payment and the current level is Batch, then the COUNT returns the total number of payments in the batch. However, if the current level is RequestHeader, the COUNT returns the total number of payments in the file across all batches. If the argument is a record type, the count function counts all the generated records of the (child level) record type belonging to the current level instance.

  • INTEGER_PART, DECIMAL_PART - returns the integer or decimal portion of a numeric value. This is used in nested expressions and in commands (display condition and group by). For the final formatting of a numeric field in the data column, use the Integer/Decimal format.

  • IS_NUMERIC - boolean test whether the argument is numeric. Used only with the "IF" control structure.

  • TRUNCATE - truncate the first argument - a string to the length of the second argument. If the first argument is shorter than the length specified by the second argument, the first argument is returned unchanged. This is a user-friendly version for a subset of the SQL substr() functionality.

  • SUM - sums all the child instance of the XML extract field argument. The field must be a numeric value. The field to be summed must always be at a lower level than the level on which the SUM function was declared.

  • MIN, MAX - find the minimum or maximum of all the child instances of the XML extract field argument. The field must be a numeric value. The field to be operated on must always be at a lower level than the level on which the function was declared.

  • FORMAT_DATE - Formats a date string to any desirable date format. For example:

    FORMAT_DATE("1900-01-01T18:19:20", "YYYY/MM/DD HH24:MI:SS")

    produces the following output:

    1900/01/01 18:19:20

  • FORMAT_NUMBER - Formats a number to display in desired format. For example:

    FORMAT_NUMBER("1234567890.0987654321", "999,999.99")

    produces the following output:

    1,234,567,890.10

  • MESSAGE_LENGTH - returns the length of the message in the EFT message.

  • RECORD_LENGTH - returns the length of the record in the EFT message.

  • INSTR - returns the numeric position of a named character within a text field.

  • SYSDATE, DATE - gets Current Date and Time.

  • POSITION - returns the position of a node in the XML document tree structure.

  • REPLACE - replaces a string with another string.s

  • CONVERT_CASE - converts a string or a character to UPPER or LOWER case.

  • CHR - gets the character representation of an argument, which is an ASCII value.

  • LPAD, RPAD - generates left or right padding for string values.

  • AND, OR, NOT - operator functions on elements.

  • DISTINCT_VALUES - equivalent to the XPATH function DISTINCT-VALUES. Returns a sequence in which all but one of a set of duplicate values, based on value equality, have been deleted. Usage: distinct_values(fieldname).

  • INCREASE_DATE - increments a date by the number of days specified.

    Usage:

    increase_date(.//date, 2)

    returns a date value two days after the value of .//date

  • DECREASE_DATE - decreases a date by the number of days specified.

    Usage:

    decrease_date(.//date, 2)

    returns a date value two before the value of .//date

  • Other SQL functions include the following. Use the syntax corresponding to the SQL function.

    • TO_DATE

    • LOWER

    • UPPER

    • LENGTH

    • GREATEST

    • LEAST

    • DECODE

    • CEIL

    • ABS

    • FLOOR

    • ROUND

    • CHR

    • TO_CHAR

    • SUBSTR

    • LTRIM

    • RTRIM

    • TRIM

    • IN

    • TRANSLATE

Testing eText Template (Offline)

We can test the eText template (offline) in local system without uploading the template to the oracle instance.

In order to test offline we need to install Oracle BI Publisher Desktop.

Steps:

1.Open Template Viewer .

2.Select the desired working directory where you have placed the RTF and xml files and select the output format as eText and select the RTF and the xml file.We can query the table iby_trxn_documents to get Outbound Payment Instruction xml.

Code:
SELECT document FROM iby_trxn_documents  WHERE DOCTYPE=100;

Then click on start processing button.


3.The 
eText  file will be generated as below.