Data Types

Data Types

Each data value has a type.

For example, it is important to identify whether something is a number or not, so that we can determine whether it can be used in a calculation.

Six main Data Types in Logiak

Here are the main data types which Logiak defines:

Two ancillary Data Types

There are two other data types:

  • media url
  • object instance

All Object fields have a data type

When you add fields to an Object, you have to specify a type for each field you add

When you view fields of an Object, you will see their names are preceded by data type icons

Object fields alphabetically

By default they appear in alphabetical order

Object fields by type

You can switch to view them grouped by type

All Process values have a data type

As with Object fields, all values in a Process have an associated type.

For example, if you add a variable, you are asked to specify which type of data the variable will hold.

Process variables by type

As with Object fields, when you are viewing Process values, you can view them grouped by type

DATE data type

Internally, dates are represented with large numbers - the number of milliseconds since 1 January 1970.

This might sound strange but it is the commonest way of representing dates

Reducing dates to numbers means that it is easy to calculate with dates.

We can add a week to a date (represented as a number), by simple addition of (7 * 24 * 60 * 60 * 1000) milliseconds.

Logiak supports you in these kinds of calculations, via the Expression Wizard.

We mention this here so that you are not surprised when the Expression Wizard produces ugly-seeming expressions containing very large numbers.

Present time

The value of the time which represents the current time, at the moment the user is using the App, is a special variable called now.

This expression gets you “now”

{special:now}

Mapping requires data type matching

When we use Process actions to create or update data, we do this by mapping Process values to Object fields.

Data type plays an important role here in ensuring Object fields get the right kind of data.

Number values are possible candidates for number fields, but text values aren’t, etc.

Mapping Logiak data types to database types

Object field datatypes in Logiak are abstract. The concrete reality is when an App is running on a device, using a specific operating system and a specific database.

So Logiak types correspond one-to-one with types in SQLite (when running on a mobile device) and Postgres (when running as web app, and for the Supabase backend).