Import Conversion and Validation
Import Conversion and Validation codes can be used to convert a data value, such as a date or time into the internal U2 representation of the data value or to validate that a data value meets a specified import edit. If the data value does not conform to the import edit, an application error will be returned.
You may specify one or more conversion codes by separating 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 functions of UniBASIC.
|
|
Conversion
|
These conversions are used to convert incoming data to other format. See the example data below and the result of applying the conversion code.
|
|
|
|
D
|
11-17-1956
|
4092
|
Converts a date into the internal U2 representation of a date
|
MCU
|
HelloWorld
|
HELLOWORLD
|
Converts the data value to uppercase.
|
MR[n[m] or MD[n[m]
|
See Below
|
|
Converts a number into the internal U2 representation of the number. n indicates the number of implied decimal places. m indicates the power of 10 to scale the number.
|
MR2
|
123.4567
|
12346
|
The number was rounded to two decimal places and the excess digits were truncated.
|
MR24
|
123.45678
|
1234568
|
Then decimal place was moved 4 positions to the right and the last required decimal place was rounded off and excess digits were truncated.
|
MT
|
10:15:32
|
36932
|
Converts a time into the internal U2 representation of a time.
|
UBOOLEAN
|
|
|
Converts a value like "Y" or "N" to the string "true" or "false".
|
UCHANGE;str1;str2
|
|
|
Change str1 to str2. Change strings may contain one or more printable characters. Non-printable characters may be entered using "0x" notation.
|
UTRIM
|
●HI●●JOE●
|
HI●JOE
|
Removes all leading, trailing and redundant spaces (shown as ●) in the data value.
|
UTRIMB
|
●HI●●JOE●
|
●HI●●JOE
|
Removes all trailing spaces (shown as ●) in the data value.
|
UTRIMF
|
●HI●●JOE●
|
HI●●JOE●
|
Removes all leading spaces (shown as ●) in the data value.
|
UUNIXDATETIME
|
2019-03-10T01:59:55-0800
|
1553807856
|
Convert a human readable date/time string into a Unix timestamp.
|
UVLIST
|
1” “2” “3”
|
1]2]3
|
Converts a U2 value list expression into a multivalued string.
|
|
Validation
|
These conversions are used to validate that the incoming data is of the correct type or format. See the example data below and the result of applying the validation code.
|
|
|
|
UALPHA
|
Main Street
|
Main Street
|
Verifies that the data value contains only alpha characters or a space.
|
UALPHANUMERIC
|
10 Main Street
|
13:53:20
|
Verifies that the data value contains only alpha characters, the numbers 0 thru 9 or a space. |
UDATE
|
|
|
Verifies that the data value is a valid date. |
UEDIT
|
KMK.Z92(VALUE, XACTION, ERR.TXT) |
|
Used to create user-defined edits that can be specified in the "Edits" field for query parameters and import fields. |
UFILE;filename[;amc;oper;value]
|
CUSTOMER |
01:53pm
|
Verifies the data value exists in the filename specified. If the optional amc, oper, and value parameters are specified, then the contents of the amc are compare to the value using the oper and if that expression evaluates to true the data value is considered valid.
|
UFILELOOKUP;filename;controlID,amc
|
UFILELOOKUP;KT_INTEGRATION_XREF;DEMO*LOG_ERR_TYPE;1
|
|
Verifies that the data value exists in the amc of the controlID in the filename specified.
|
UITRANS;lookup_key
|
MASTERCARD
|
M/C
|
Integration translate replaces the current data value with the value found in the lookup table referenced by the lookup_key. This edit only executes if the current data value is a non-null string. The lookup_key is the item-id of the record in the KT_INTEGRATION_XREF file.
|
UOPEN,filename
|
|
|
This verifies that the file specified in filename can be opened.
|
UNOSPACE
|
●HI●●JOE● |
●HI●●JOE● |
Verifies that the data value does not contain a space (shown as ●). For the example data shown this would have generated an error. |
UMATCH;val1;val2
|
|
|
Verifies that the data value matches the value specified in val1 - valn.
|
UNUMERIC
|
123456 |
123456
|
Verifies that the data value is numeric. |
UTIME
|
|
|
Verifies that the data value is a valid time.
|
UURL
|
|
|
Verifies that the data entered only contains legal URL characters.
|
|