version 3
QUERY SUBRECORDS (subtable; queryFormula)
Parameter | Type | Description | |
subtable | Subtable | Subtable to search | |
queryFormula | Boolean | Query formula |
Description
QUERY SUBRECORDS queries subtable and creates a new subselection. This is the only command that queries subrecords and returns a selection of subrecords. The queryFormula is applied to each subrecord in subtable. If the formula evaluates as TRUE, the subrecord is added to the new subselection. When the query is complete, QUERY SUBRECORDS makes the first subrecord the current subrecord of subtable.
Remember that QUERY SUBRECORDS queries only the subrecords of the subtable contained in the currently selected parent record, and not all the subrecords associated with the records of the parent table. QUERY SUBRECORDS does not change the current parent record.
Typically, queryFormula tests a subfield against a variable or a constant, using a relational operator. The queryFormula can contain multiple tests that are joined by AND conjunctions (&) or OR conjunctions ( | ). Also, the queryFormula can be a function or contain a function. The wildcard character (@) can be used with string arguments.
If neither a current record nor a higher-level subrecord exists, QUERY SUBRECORDS has no effect.
Example
The following example queries for children older than 10 years:
QUERY SUBRECORDS ([People]Children; [People]Children'Age>10)
See Also
ALL SUBRECORDS, ORDER SUBRECORDS BY, Records in subselection.