Adding Child Rowsets
The first parameter of the CreateRowset method determines the top-level structure. If you pass the name of the record as the first parameter, the rowset is based on a record. You can also base the structure on a different rowset. In the following example, &MYRS2 inherits the structure of &MYRS1:
Local Rowset &MYRS1, MYRS2;
&MYRS1 = CreateRowset(RECORD.SOMEREC1);
&MYRS2 = CreateRowset(&MYRS1);To add a child rowset, suppose the following records describe a relationship. The structure is made up of three records:
-
PERSONAL_DATA
-
BUS_EXPENSE_PER
-
BUS_EXPENSE_DTL
To build rowsets with child rowsets, use code like the following:
Local Rowset &rsBusExp, &rsBusExpPer, &rsBusExpDtl;
&rsBusExpDtl = CreateRowset(Record.BUS_EXPENSE_DTL);
&rsBusExpPer = CreateRowset(Record.BUS_EXPENSE_PER, &rsBusExpDtl);
&rsBusExp = CreateRowset(Record.PERSONAL_DATA, &rsBusExpPer);Another variation is
&rsBusExp = CreateRowset(Record.PERSONAL_DATA,
CreateRowset(Record.BUS_EXPENSE_PER,
CreateRowset(Record.BUS_EXPENSE_DTL)));