Skip to main content

Data types

Overview

In Qodly, data are handled according to their type in two places: the datastore and the QodlyScript language.

Although they are usually equivalent, some data types available at the datastore level are not directly available in the language and are automatically converted. Conversely, some data types can only be handled through the language. The following table lists all available data types and how they are supported/declared:

Data TypesVariable declarationDatastore support (type)Default value
blobvar blobblob0 byte
var 4D.Blobobjectnull
booleanvar booleanboolfalse
collectionvar collection-null
datevar datedate00-00-00
null--null
numbervar integer, var numbernumber0
objectvar objectobjectnull
picturevar pictureimagepictureSize == 0
stringvar stringstring""
timevar timeduration00:00:00
undefined--undefined
variantvar variant-undefined
note

Variant is actually not a data type but a variable type that can contain a value of any other data type.

You can evaluate a data type using type and valueType commands.

Converting data types

QodlyScript contains operators and commands to convert between data types, where such conversions are meaningful. QodlyScript enforces data type checking. For example, you cannot write: "abc"+0.5+!12/25/96!-?00:30:45?. This will generate syntax errors.

The following table lists the basic data types, the data types to which they can be converted, and the commands used to do so:

Data Type to Convertto Stringto Numberto Dateto Timeto Boolean
String (1)numdatetimebool
Number (2)stringbool
Datestringbool
Timestringbool
Booleannum

(1) Strings formatted in JSON can be converted into scalar data, objects, or collections using the jsonParse command.

(2) Time values are durations and can be treated as numbers.

note

In addition to the data conversions listed in this table, more sophisticated data conversions can be obtained by combining operators and other commands.