version 3
ORDER SUBRECORDS BY (subtable; subfield{; > or <}{; subfield2; > or <2; ...; subfieldN; > or <N})
Parameter | Type | Description | |
subtable | Subtable | Subtable by which to order the selected subrecords | |
subfield | Subfield | Subfield on which to order by for each level | |
> or < | Ordering direction for each level: | ||
> to order in ascending order or | |||
< to order in descending order |
Description
ORDER SUBRECORDS BY sorts the current subselection of subtable. It sorts only the subselection of the subtable contained in the current parent record.
The direction parameter specifies whether to sort subfield in ascending or descending order. If direction is the "greater than" symbol (>), the subrecords are ordered in ascending order. If direction is the "less than" symbol (<), the subrecords are ordered in descending order.
You can specify more than one level of sort by including more subfields and sort symbols.
After the sort is completed, the first subrecord of the sorted subselection is the current subrecord. Sorting subrecords is a dynamic process. Subrecords are never saved in their sorted order. If neither a current record nor a higher-level subrecord exists, ORDER SUBRECORDS BY has no effect.
If a form contains a subform that is to be printed in a fixed frame, this command needs to be called just once before printing in the Before phase of the parent form method.
Example
The following example sorts the [Stats]Sales subtable into ascending order, based on the SalesDollars subfield:
ORDER SUBRECORDS BY ([Stats]Sales; [Stats]Sales'Dollars; >)
See Also