Skip to content
HPCCSystems Solutions Lab
HPCCSystems Solutions Lab

RECORD

Defines the layout of fields in the dataset, order of the fields should be exactly the same as the dataset columns. There are two ways to define the record structure. Doesn’t matter which one you use results would be exactly the same.

Keep in mind that you can’t output RECORD as it is a definition. RECORD can be used with other functions such as DATASET, and TABLE.

SQL vs. ECL

RECORD functions the same way as CREATE TABLE in SQL.

SQLECL
CREATE TABLE (
  PersonID INTEGER,
  Name    STRING,
  Age    INTEGER,
  Wages   REAL,
  hasHome INTEGER
);
RECORD
  INTEGER PersonID;
  STRING   Name ;
  INTEGER  Age;
  REAL   Wages;
  INTEGER  hasHome;
END;

Using Keywords

Syntax

attr_layout := RECORD
    data_type    field1;
    data_type    field2;
    ...
    ...
    ...
    data_type    field100;
END;

Using Braces { }

Syntax

attr_layout := {
               data_type field1;
               data_type field2;
               ...
               ...
               data_type field100
               };
ValueDefinition
attr_layoutThe name by which the dataset will be invoked.
data_typeData type for the field.
field1 … field100Name of your fields/columns.

Example

// Using keywords
salaryAvg_1 := RECORD
            STRING  Job;
            STRING  Category;
            STRING  City;
            STRING2 State;
            INTEGER AvgSalary;
            INTEGER LowerBand;
            INTEGER Upperband;
END;

// Using { }
salaryAvg_2 := {
                STRING  Job;
                STRING  Category;
                STRING  City;
                STRING2 State;
                INTEGER AvgSalary;
                INTEGER LowerBand;
                INTEGER Upperband;
                };