QMLocate() |
![]() ![]() ![]() |
The QMLocate() function searches a dynamic array for a field, value or subvalue matching a given string.
Format
where
If omitted, no sort order is applied.
The QMLocate() function searches a dynamic array at one of three levels:
If Vno is less than 1, the function searches the dynamic array for a field matching Item, starting at the field position given by Fno.
If Vno is given but Svno is less than 1, the function searches field Fno of the dynamic array for a value matching Item, starting at the value position given by Vno.
If Vno and Svno are given, the function searches field Fno, value Vno of the dynamic array for a subvalue matching Item, starting at the value position given by Svno.
The Order argument determines the sorting system to be applied during the search:
If Order is a null string, no sort rules are applied. The function scans all applicable dynamic array elements for a match against Item. The Pos variable will be returned as the position at which the item was found. If the item is not found, Pos will be returned as the position at which a new element could be appended.
If the first character of Order is A, an ascending sort is applied. If the first character of Order is D, a descending sort is applied. In either case, the search terminates if an entry is found that would be beyond the correct position for Item. In this case, if the item is not found, Pos will be returned as the position at which to insert Item to maintain the correct sort order.
If the second character of Order is L, a left aligned comparison is performed. Each entry of the dynamic array is compared with Item character by character from the left until a difference is found.
If the second character of Order is R, a right aligned comparison is performed. If the two items being compared are of different lengths, spaces are added to the front of the shorter item before comparison.
The QMLocate() function returns True if the item is found, False if it is not found. |