When using the command QUERY BY FORMULA or QUERY SELECTION BY FORMULA, you can perform sophisticated record analysis by placing a call to a Project Method in the queryFormula parameter instead of just using a 4D expression. For example:
QUERY BY FORMULA([theTable]; mySpecialQuery)
The method specified ('mySpecialQuery' in the above example) must return a Boolean result which indicates whether the record should be included in the found set or not.
` Project Method: mySpecialQuery
IF (([theTable]field1="DPTA@") & ([theTable]field2>100))
$0:=True ` the record meets our criteria
ELSE
$0:=False ` the record should be excluded
END IF
Note that QUERY BY FORMULA and QUERY SELECTION BY FORMULA are slower than a regular QUERY when used on indexed fields, because they always perform a sequential search not an indexed search (i.e. every record must be loaded and tested in turn).