Using Substitution Tags


Substitution tags are identifiers that you may include in the fields of an email template or any other field that supports substitutions. Kourier substitutes these tags with dynamic data that provides information specific to a given process.

The data can come from a database record, user-defined data, a system function, programmed value, or system namespace

The format of substitution tags is:

{ [tag.code] tag.name [ ( output.conversion ) ] }

The optional tag.code identifies the source of the data to be substituted. Tag codes must be one of the following:

 

tag.code

Tag Type

none

Database record

@

System function

#

User-defined

%(0N)

Context value number (Classic Mode)

%(0X)

Context value name (Name-Value Pairs)

$namespace.property

Namespace property value

The tag.name determines the specific data value to substitute and is interpreted based on the tag.code as described below.

The substitution tag can optionally contain an output.conversion to control the data format as desired. Any valid output conversion code can be used.

Tag Types

Database Record Tags

Database record tags are defined by placing the dictionary name for the desired field in between the opening bracket ({)and the closing bracket (}) without a leading tag code (i.e. {CUSTOMER_NO}).  These type of tags can only be used instead an E-mail Template.

 

User-Defined Tags

User-defined substitution tags with a tag.code of the "pound" character (#) are values that are defined in the System Literals page.  User-defined substitution tags with a tag.code of $INT are name value pairs that are defined in the Integration Definition page.

 

System Function Tags

System function tags with a tag.code of the "at" character (@) allow you to select program-derived substitutions from a pre-defined list. The list of valid system function tags are shown below:

 

Tag Name

Description

{@ACCOUNT}

Inserts the account name

{@ACCOUNT_PATH}

Inserts the full path name to the current account.

{@DATE}

Inserts the current date in internal format.

{@DATE+n} or {@DATE-n}

Inserts the current date in internal format and subtracts the value of n from the date

{@DATE_FDCM}

Based upon the current date, inserts the first date of the current month in internal format.

{@DATE_FDCQ}

Based upon the current date, inserts the first date of the current quarter in internal format.

{@DATE_FDCY}

Based upon the current date, inserts the first date of the current year in internal format.

{@DATE_FDNM}

Based upon the current date, inserts the first date of the next month in internal format.

{@DATE_FDNQ}

Based upon the current date, inserts the first date of the next quarter in internal format.

{@DATE_FDNY}

Based upon the current date, inserts the first date of the next year in internal format.

{@DATE_FDPM}

Based upon the current date, inserts the first date of the previous month in internal format.

{@DATE_FDPQ}

Based upon the current date, inserts the first date of the previous quarter in internal format.

{@DATE_FDPY}

Based upon the current date, inserts the first date of the previous year in internal format.

{@DATE_LDCM}

Based upon the current date, inserts the last date of the current month in internal format.

{@DATE_LDCY}

Based upon the current date, inserts the last date of the current year in internal format

{@DATE_LDNM}

Based upon the current date, inserts the last date of the next month in internal format.

{@DATE_LDPM}

Based upon the current date, inserts the last date of the previous month in internal format.

{@DATE_LDPY}

Based upon the current date, inserts the last date of the previous year in internal format.

{@DATETIME}

Based upon the current date, inserts the current date and time in external format which is suitable as a SQL datetime field.

{@HHMMSS}

Based upon the current time, inserts hours, minutes and seconds without delimiters.

{@ID}

Inserts the item-id of the record currently being processed.

{@LIST list.stmt}

Outputs data in a columnar format. This command supports a subset of the standard UniData/UniVerse syntax for the LIST verb. Only field names followed by the COL.HDG, CONV, and FMT keywords are supported. If multi-line columnar heading is required, each line is separated by the (|) character. The tag is only available in the message body of an e-mail.

{@QSELECT sel.stmt}

Performs the qselect statement. This statement is required prior to an @LIST tag to qualify the data for display. Standard UniData/UniVerse syntax is supported. The tag is only available in the message body of an e-mail.

{@SELECT sel.stmt} or {@SSELECT sel.stmt}

Performs the select statement. This statement is required prior to an @LIST tag to qualify the data for display. Standard UniData/UniVerse syntax is supported. The tag is only available in the message body of an e-mail.

{@SPACE(n)} or {@SPC(n)}

Inserts a blank character or characters as defined in the mask (n) where n is the number of blank character to insert. This tag is useful for indenting information within the message. For example, {@SPC(10)} will insert 10 blank characters in the message.

{@STR}

Inserts a string of characters as defined in the mask (x|n) where x is the string of characters and n is the display length. For example, {@STR(=|40)} will produce a string of 40 "=" characters while {@STR(+-|40)} will produce a string with the pattern of "+-" character to a length of 40 characters.

{@TIME}

Inserts the current time in internal format.

{@TRANS; filename;item_id;attr_no;value_no}

Reads an item from a file. For example, {@TRANS;TABLES;CO-NAME;9(T1,4) will read the item CO-NAME from the file TABLES and return the first 4 characters of attribute 9.

{@USER_ID}

Inserts the current Preview user ID.

{@USER_NAME}

Inserts the current Preview user name.

{@USER_NO} or {@USERNO}

Inserts the RDBMS user number.

{@YYMMDD}

Based upon the current date, inserts the two digit year, two digit month and two digit day without delimiters.

{@YYYYMMDD}

Based upon the current date, inserts the four digit year, two digit month and two digit day without delimiters.

 

Context Value tags

Context value tags with a tag.code of the "percent" character (%) allow you to substitute data values determined programmatically. There are two variants of this type of tag.

When you use the value number form (%0N), values are passed as a value-delimited list of data values. The tag.name is an integer value number that represents the value to extract from the list.

When use the Name-Value Pair mode (%0X), values are passed in as a value-delimited list of data values as well, but each value has two sub-values.  The first sub-value is the case-insensitive name of a value, and the second sub-value is the data value for that name. The tag.name indicates the name of the attribute to use to find the data value to substitute.
 

Namespace value tags

Namespace value tags are used to access values of properties in one of the predefined Kourier system namespaces. The syntax of a namespace value tag is shown here:

{$space.prop}

where space is the desired namespace from the table below, and prop is the property name from within that namespace.  Using this substitution tag inserts the value of the property prop, from the name-value-pair of the namespace space.

Some namespaces are in scope only at certain times.  For example, the INT namespace is only in scope when a Kourier service is running.  In addition, if space is not a valid namespace, or prop is not a valid property in that namespace, then the tag resolves to nil.

 

Namespace

Description

Scope

INT

Access to properties from the current integration as defined in Integration Definition page. 

For example, $INT:DEMO.SITE_ID will return the SITE_ID from the DEMO integration.  

Integration of the currently running service.

SRVC

Access to properties from the KMK.SERVICE command line. 

For example, $SRVC:CUTOFF_DATE would return the value of "01-01-08" if the service command line was: KMK.SERVICE DEMO_KTLOG HEADERS "cutoff_date=01-01-08".

The namespace can be used in any command running in the context of a service.