4D v13.4

ORDER SUBRECORDS BY

Home

 
4D v13.4
ORDER SUBRECORDS BY

ORDER SUBRECORDS BY 


 

ORDER SUBRECORDS BY ( subtable ; subfield {; > or <}{; subfield2 ; > or <2 ; ... ; subfieldN ; > or <N} ) 
Parameter Type   Description
subtable  Subtable in Subtable by which to order the selected subrecords
subfield  Subfield in Subfield on which to order by for each level
> or <  Operator in Ordering direction for each level: > to order in ascending order or < to order in descending order

Subtables are no longer supported starting with version 11 of 4D. A compatibility mechanism ensures the functioning of this command in converted databases; however, it is strongly recommended to replace any subtables with standard related tables.

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;>)

 
PROPERTIES 

Product: 4D
Theme: Subrecords
Number: 107

This command is deprecated and should not be used anymore

 
INDEX

Alphabetical list of commands

 
HISTORY 

Modified: 4D v11 SQL

 
SEE ALSO 

QUERY SUBRECORDS