Understanding records

This is an introduction to records.

A record defines a structured variable, where each member can be defined with a specific data type.

Records are used in interactive instructions like INPUT to control forms, and record are also used in INSERT and UPDATE SQL instructions, to update the database table.

Records can contain sub-record structures, and list types like arrays and dictionaries:

DEFINE reader RECORD
            id INTEGER,
            name VARCHAR(100),
            birth DATE,
            address RECORD
                num VARCHAR(20),
                street VARCHAR(200),
                city_id INTEGER,
                state_id VARCHAR(5)
            END RECORD,
            book_ids DYNAMIC ARRAY OF INTEGER
       END RECORD

Records are typically used to store the values of a database row. Records can be based on the column types of a database table, which is defined in a database schema (SCHEMA):

SCHEMA stores
DEFINE cust RECORD customer.*
-- cust is defined with the column of the customer table
The following list summarizes record usage: