For basic information about data types used in metadata see Data Types and Record Types
In any program, you can use some variables. Data types in CTL are the following:
Its declaration look like this: boolean
identifier
;
This data type is an array of bytes of a length that can be
up to Integer.MAX_VALUE
as a maximum. It
behaves similarly to the list data type (see below).
Its declaration looks like this:
byte
identifier
;
This data type is a compressed array of bytes of a length that can be
up to Integer.MAX_VALUE
as a maximum. It
behaves similarly to the list data type (see below).
Its declaration looks like this:
cbyte
identifier
;
Its declaration look like this: date
identifier
;
Its declaration looks like this:
decimal
identifier
;
By default, any decimal may have up to 32 significant digits.
If you want to have different Length or Scale,
you need to set these properties of decimal
field in metadata.
Example 62.2. Example of usage of decimal data type in CTL2
If you assign 100.0 /3 to a decimal variable, its value might for example be 33.333333333333335701809119200333
.
Assigning it to a decimal field (with default Length and Scale, which are 8 and 2, respectively),
it will be converted to 33.33D
.
You can cast any float number to the decimal data type by
apending the d
letter to its end.
Its declaration looks like this: integer
identifier
;
If you apend an l
letter to the end of
any integer number, you can cast it to the long data type
Its declaration looks like this: long
identifier
;
Any integer number can be cast to this data type by appending
an l
letter to its end.
Its declaration looks like this: number
identifier
;
The declaration looks like this: string
identifier
;
Each list
is a container of one the following data types:
boolean
,
byte
, date
,
decimal
, integer
, long
,
number
, string
, record
.
The list data type is indexed by integers starting from 0.
Its declaration can look like this: string[]
identifier
;
List cannot be created as a list of lists
or maps
.
The default list is an empty list.
Examples:
integer[] myIntegerList; myIntegerList[5] = 123;
Customer JohnSmith;
Customer PeterBrown;
Customer[] CompanyCustomers;
CompanyCustomers[0] = JohnSmith;
CompanyCustomers[1] = PeterBrown
Assignments:
myStringList[3] = "abc";
It means that the specified string is put to the fourth position in the string list. The other values are fille with null
as follows:
myStringList
is [null,null,null,"abc"]
myList1 = myList2;
It means that both lists reference the same elements.
myList1 = myList1 + myList2;
It adds all elements of myList2
to the
end of myList1
.
Both list must be based on the same primitive data type.
myList1 = myList1 + "abc";
It adds the "abc"
string to the myList1
as its new
last element.
myList1
must be based on string data type.
myList1 = null;
It destroys the myList1
.
Be careful when performing list operations (such as append). See Warning.
This data type is a container of pairs of a key and a value.
Its declaration looks like this: map[<type of key>, <type of value>]
identifier
;
Both the Key
and the Value
can be of the following primitive data types:
boolean
,
byte
, date
,
decimal
, integer
, long
,
number
, string
. Value
can be also of record
type.
Map cannot be created as a map of lists
or other maps
.
The default map is an empty map.
Examples:
map[string, boolean] map1; map1["abc"]=true;
Customer JohnSmith;
Customer PeterBrown;
map[integer, Customer] CompanyCustomersMap;
CompanyCustomersMap[JohnSmith.ID] = JohnSmith;
CompanyCustomersMap[PeterBrown.ID] = PeterBrown
The assignments are similar to those valid for a list.
This data type is a set of fields of data.
The structure of record is based on metadata. Any metadata item represent a data type.
Declaration of a record looks like this:
<metadata name>
identifier
;
Metadata names must be unique in a graph. Different metadata must have different names.
For more detailed information about possible expressions and records usage see Accessing Data Records and Fields.
Record does not have a default value.
It can be indexed by both integer numbers and strings (field names). If indexed by numbers, fields are indexed starting from 0.