Sorting:
Results may be sorted by adding ORDER BY [field name] to the end of the query. Further Adding DESC will sort in descending order. Note only one field may be sorted on. For example, the following will generate a list of all, open, non-reservation sales for a given operator, group and subgroup within the last 24 hours and order the results in descending order of the BALANCEDUE field:
AutoRecall="first_name,last_name,descrip1,orig_dt,balancedue FROM sh_save WHERE date_time > DATETIME(YEAR(DATE()), MONTH(DATE()), DAY(DATE())-1) .AND. '<GROUP>' $ RECALL1 .AND. '<SUBGROUP>' $ recall2 .AND. operator = '<OPERATOR>' .AND. salespoint = '<SALESPOINT>' .AND. finalized = .F. AND reserv_no = 0 ORDER BY balancedue DESC"
To query for a blank field, you cannot compare the field to an empty string. For example, if you used the following expression:
MYFIELD = ''
The results of the query would contain records where MYFIELD is not blank. This is because comparisons are between two strings up to the length of the shorter string. Therefore an empty string, which has a length of 0, will always match the first 0 characters of a field. Instead of comparing with an empty string, you should compare the field to a blank string:
MYFIELD = ' '
Where ' ' is padded with spaces up to the length of MYFIELD.