Import Conversion and Validation
Import
Conversion and Validation codes can be used 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 |
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. |
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. |
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. |
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 consider
valid. |
UNUMERIC |
123456 |
123456 |
Verifies
that the data value is numeric. |
UDATE |
|
|
Verifies
that the data value is a valid date. |
UTIME |
|
|
Verifies
that the data value is a valid time. |
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. |
|