Conversion codes are applied to the raw data in a field to transform that data into a different format. Dates are a good example of where a convesion code should be used. Internally, all dates are stored as an integer representing the number of days relative to Day 0 (in UniVerse, Day 0 is December 31, 1967). When a date is retrieved from this field, it must be converted to a conventional form that is recognizable to the user. You may specify one or more conversion codes by seperating each conversion code by the pipe (|) character. If you use multiple conversion codes, the codes are applied from left to right, so that the leftmost code is applied to the original value, then the next conversion code to the right is applied to the result of the first conversion, and so on. Generally, conversion codes are identical to those used in the ICONV and OCONV functions of BASIC.
The following table describes some of the more useful standard conversion codes and any Kourier conversion code extensions. For a complete list of conversion codes please consult your U2 documentation.
Conversion | Description | ||||||||||||||||||||||||||||||||||||
Date |
The date conversion code is used to convert internal dates to external formats.
Assuming an internal date of 14201, the following conversion codes will produce
the result shown.
|
||||||||||||||||||||||||||||||||||||
Time |
The time conversion code is used to convert internal times to external formats.
Assuming an internal time of 50000, the following conversion codes
will produce the result shown.
|
||||||||||||||||||||||||||||||||||||
Group Extract |
The group extract conversion code is used to extract one or more values from a string
separated by a given delimiter. Assuming a string of 123*456*789:XY,
the following conversion codes will produce the result shown.
|
||||||||||||||||||||||||||||||||||||
Numbers |
The MR or MD conversion codes are used to convert internal numbers to external formats.
Assuming an internal number of 1420190, the following conversion
codes will produce the result shown.
|
||||||||||||||||||||||||||||||||||||
Characters |
The mask character conversion codes is used to select certain types of characters
out of a string. Assuming a character string of 492 Seacrest Dr.,
the following conversion codes will produce the result shown.
|
||||||||||||||||||||||||||||||||||||
Substitution |
The substitution conversion code allows you to specify simple if/then processing
on a data value. The format of the substitution conversion code is S;op1;op2. op1 - is the value to use if the field is not null. If op1 is numeric then the value is returned from the current record (if the value is greater than zero) or from the item-id of the current record (if the value is zero). If op1 is a delimited text string, that value is returned. If op1 is an asterisk, the original value is returned. op2 - is the value to use if the field is null. If op2 is numeric then the value is returned from the current record (if the value is greater than zero) or from the item-id of the current record (if the value is zero). If op2 is a delimited text string, that value is returned. If op2 is an asterisk, the original value is returned. |
||||||||||||||||||||||||||||||||||||
Text Extract |
The text extract conversion code is used to extract a certain number of characters
from a text string. Assuming a character string of 492 Seacrest Dr.,
the following conversion codes will produce the result shown.
|
||||||||||||||||||||||||||||||||||||
Translate |
The Tfile conversion code converts values from one file to another by translating
through a file. It uses data values in the source file as IDs for records in a lookup
file. The source file can then reference values in the lookup file. To access the
lookup file, its record IDs (field 0) must be referenced. If no reference is made
to the record IDs of the lookup file, the file cannot be opened and the conversion
cannot be performed. The format of the translate conversion code is Tfilename
; c [vmc]; [ivmc] ; [ovmc]. filename - the name of the lookup file. It can be preceeded by the keyword DICT to reference the files dictionary. c - translate subcode. When used in Kourier, you should only use the C (if conversion is impossible, return the orginal value) and X (if conversion is impossible, return an empty string). The translate subcode may be followed by a number indicating which value to return from a multivalued field. ivmc - When used in Kourier, this field should always be omitted. ovmc - Indicates the attribute number in the lookup file to return.
|
||||||||||||||||||||||||||||||||||||
@ Codes |
Conversion codes that being with an @ character provide special capabilities.
The following table indicated the supported @ codes.
|
||||||||||||||||||||||||||||||||||||
Literal Strings | To specify a literal string, enclose the data
value in quotes or double quotes.
For example, entering "{@YYYYMMDD}" (including the quotation marks) will return the current system date in YYYYMMDD format. Entering "KOURIER" (including the quotation marks) will return the string KOURIER. The string can specify any number of valid substitution tags enclosed by curly braces ( {} ). |