The $Reverse function reverses the order of a string.
The format of $Reverse is:
where string is any character string.
Print $Reverse('AB CDEF')
prints the value
$Reverse is particularly useful when the file manager defines an ORDERED field to contain the characters of a frequently retrieved field in reverse order. Thus, when leading wildcard patterns (for example,
*SON) are used to retrieve records or values, the patterns can be reversed to optimize the ordered retrieval. If the patterns remain in leading wildcard form and the original, unreversed field is used to retrieve values or records, the entire Ordered Index is searched to find the values satisfying the pattern.
For example, an ORDERED field named
WORD exists, and values ending in
LY are to be retrieved frequently. To optimize this retrieval, another ORDERED field named
REVERSE.WORD can be defined to store the reversed values in the
WORD field, and the pattern
*LY can be reversed to retrieve values in
REVERSE.WORD LIKE 'YL*'. The pattern
YL* optimizes the Ordered Index retrieval, providing much faster performance than