ROW( row , resultrec )
ROW( [ row , ] transform )
fields | A comma-delimited list of data values for each field in the recstruct, contained in curly braces ( {} ). |
recstruct | The name of the RECORD structure defining the field layout. |
row | A single row of data. This may be an existing record, or formatted in-line data values like the fields parameter description above, or an empty set ( [ ] ) to add a cleared record in the format of the resultrec. If omitted, the record is produced by the transform function. |
resultrec | A RECORD structure that defines how to construct the row of data, similar to the type used by TABLE. |
transform | A TRANSFORM function that defines how to construct the row of data. |
Return: | ROW returns a single record. |
The ROW function creates a single data record and is valid for use in any expression where a single record is valid.
The first form constructs a record from the in-line data in the fields, structured as defined by the recstruct. This is typically used within a TRANSFORM structure as the expression defining the output for a child dataset field.
Example:
AkaRec := {STRING20 forename,STRING20 surname};
outputRec := RECORD
UNSIGNED id;
DATASET(AkaRec) kids;
END;
inputRec := {UNSIGNED id,STRING20 forename,STRING20 surname};
inPeople := DATASET([{1,'Kevin','Halligan'},{1,'Kevin','Hall'},
{2,'Eliza','Hall'},{2,'Beth','Took'}],inputRec);
outputRec makeFatRecord(inputRec L) := TRANSFORM
SELF.id := l.id;
SELF.kids := DATASET([{ L.forename, L.surname }],AkaRec);
END;
fatIn := PROJECT(inPeople, makeFatRecord(LEFT));
outputRec makeChildren(outputRec L, outputRec R) := TRANSFORM
SELF.id := L.id;
SELF.kids := L.kids + ROW({R.kids[1].forename,R.kids[1].surname},AkaRec);
END;
r := ROLLUP(fatIn, id, makeChildren(LEFT, RIGHT));
OUTPUT(r);