Accessing fields in records

You can access fields within a named record by using the @ character.

Accessing fields within a named record

The @ character allows top-level fields to be set, and can be used to retrieve nested fields.

Note: The @ character does not apply to in-scope records.

Retrieving data from a record

Record inScopeCopy = GetInScopeRecord();

Retrieving a field

int i = @inScopeCopy.integerMemberField;

Retrieving a nested field

text nested = @inScopeRecordCopy.ExtraInfo.ExampleSubfield;

Writing data to a record

The following examples write data to a record:

Record newRec;
@newRec.intField = i;
@newRec.anotherIntField = eval(int, '$i');
@newRec.textField = "constant string";

The following example extracts the field name from another variable and then writes the data to a record:

text myField = "customField";
@newRec.eval(text, '$myField') = "customValue";"

Writing nested objects and lists

Record newRec;
@newRec.m_ExtraInfo->m_NestedObject   = eval(text, '$internetNodeIP');
@newRec.m_ExtraInfo->m_NestedList(2)   = eval(text, '$internetNodeIP');
@newRec.m_ExtraInfo->m_DeeperNest->m_VeryNestedList(0)   = eval(text, '$internetNodeIP');

The above code builds a record like the following example:

        m_ExtraInfo={
                m_NestedObject='99.99.99.99';
                m_NestedList=['','','99.99.99.99'];
                m_DeeperNest={
                        m_VeryNestedList=['99.99.99.99']
                }
        }