Fields and data types

Fields define the data that can be stored in a record. Fields define the name that is used to retrieve data from a record and the data type the data will be stored as. Compared to a spreadsheet tabel, fields are the name and data type of columns.

Adding and editing fields

In the "fields" tab in each class page in the blueprint we can add and remove the fields that belong to it. More properties can be set at the field details.

The content of most fields will be stored in the database (the alternative is generating it through calculations). To store the data in the database, a database column name must be entered. This name can be generated automatically using the Generate column names button. Calculated fields do not have to be stored in the database, since their values can be derived at runtime.

Data types

The data type of a field defines what type of input field is used for the data. Every data type has it's own constraints, for example when the data type is "date", only valid dates will be allowed as input. Use the "Select from a list with explanations"-button to select the desired data type. If you do not specify a data type, "text" will be used as default.  

The most common data types are:

  • autonumber
  • per object (record) in the class a new sequence number will be generated. This data type is used for key fields.
  • text
  • normal text on a single line.
  • whole number
  • whole numbers (integers), positive and negative.
  • decimal number
  • decimal numbers, positive and negative.
  • boolean
  • can have 2 values: true or false. Used for yes/no or on/off properties.
  • date
  • a date.
  • time
  • a time.
  • date & time
  • the combination of a date and time.
  • email address
  • the values will be checked to make sure they are valid email addresses.
  • memo
  • a text field to store multi line text.
  • money
  • to store monetary values.

Some examples: for fields like "first name", "last name" and "gender", the data type "text" will do. For a field "product number" or "id number" the data type could be set to "whole number". However, if "id number" is used as a key field the values should be unique, meaning that identical numbers are not allowed. Users could check and enter the unique values manually, but in most cases it is preferable to let the Application Engine handle this task. To activate this, set the data type of your key field to "Autonumber".

You can change the data type after it has been used to enter records, but this can have consequences for the data in the active database.  E.g. when you change the data type from ‘text to ‘whole number all data containing non-numerical characters will be lost.  

In addition to the fixed data types, there are two other options:

  • global lookup lists
    When you have defined global lookup lists (see Using lookup lists) you can also select one of these lookup lists.
     
  • foreign classes
    When you have defined relations (see Relations between classes) then you can also select an other class as foreign class.

Please read the other tutorials to learn more about these options.