DATASET( row )
This form is only used in an expression context. It allows you to in-line a single record dataset.
Example:
//the following examples demonstrate 4 ways to do the same thing:
personRecord := RECORD
STRING20 surname;
STRING10 forename;
INTEGER2 age := 25;
END;
namesRecord := RECORD
UNSIGNED id;
personRecord;
END;
namesTable := DATASET('~LR::TestRow',namesRecord,THOR);
//simple dataset file declaration form
addressRecord := RECORD
UNSIGNED id;
DATASET(personRecord) people; //child dataset form
STRING40 street;
STRING40 town;
STRING2 st;
END;
personRecord tc0(namesRecord L) := TRANSFORM
SELF := L;
END;
//** 1st way - using in-line dataset form in an expression context
addressRecord t0(namesRecord L) := TRANSFORM
SELF.people := PROJECT(DATASET([{L.id,L.surname,L.forename,L.age}],
namesRecord),
tc0(LEFT));
SELF.id := L.id;
SELF := [];
END;
p0 := PROJECT(namesTable, t0(LEFT));
OUTPUT(p0);
//** 2nd way - using single-row dataset form
addressRecord t1(namesRecord L) := TRANSFORM
SELF.people := PROJECT(DATASET(L), tc0(LEFT));
SELF.id := L.id;
SELF := [];
END;
p1 := PROJECT(namesTable, t1(LEFT));
OUTPUT(p1);
//** 3rd way - using single-row dataset form and ROW function
addressRecord t2(namesRecord L) := TRANSFORM
SELF.people := DATASET(ROW(L,personRecord));
SELF.id := L.id;
SELF := [];
END;
p2 := PROJECT(namesTable, t2(LEFT));
OUTPUT(p2);
//** 4th way - using in-line dataset form in an expression context
addressRecord t4(namesRecord l) := TRANSFORM
SELF.people := PROJECT(DATASET([L], namesRecord), tc0(LEFT));
SELF.id := L.id;
SELF := [];
END;
p3 := PROJECT(namesTable, t4(LEFT));
OUTPUT(p3);