Indexed Lists
In an indexed list, each list item can be referred to by a sequential number that identifies its position. The items are numbered starting with one.
For example, in the following list, the item in
position 1 is Monday
, in position 2 is Tuesday
, and so on.
"Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;Sunday"
Typed Lists
Uniface allows you to specify the data type of a list item. When used in ProcScript, the item value is then interpreted according to its data type. This is especially useful for sorting, because by default lists are sorted as strings. It is also useful when constructing a list of parameters to be passed with the activate/list command.
To explicitly specify the type as Boolean, Float, or String, use the $typed function. For other data types and syntax strings, you can use a data type ProcScript function.
Using $typed | Type-specific ProcScript Function | Returns |
---|---|---|
$typed("$boolean( Value)")
|
Boolean | |
$typed("$clock( Value)")
|
$clock( Value)
|
Time type |
$typed("$date( Value)")
|
$date( Value)
|
Date type |
$typed("$datim( Value)")
|
$datim( Value)
|
DateTime type |
$typed("$float( Value)")
|
Float type | |
$typed("$number( Value)")
|
$number( Value)
|
Number type |
$typed("$string( Value)")
|
Although there is a $string ProcScript function, it is used to convert XML entities to strings, not to convert data to String. | Constant string type |
$typed("$syntax( Value)")
|
$syntax( Value)
|
Syntax string type |
Typed List
For example, the following code generates a list
with different values for 012345
depending on the data type:
variables string vList endvariables putitem vList, -1, $typed("$string(012345)") putitem vList, -1, $typed("$boolean(012345)") ; start with 0 yields F putitem vList, -1, $typed("$boolean(12345)") ; start with any other character yields T putitem vList, -1, $typed("$float(012345)") putitem vList, -1, $number(012345) putitem vList, -1, $date(12-3-45) ; requires valid input string putitem vList, -1, $clock(012345) ;Result: vList = 012345;F;T;12345;12345;20450312;0000000001234500