$Reverse: Difference between revisions
No edit summary |
|||
Line 9: | Line 9: | ||
</p> | </p> | ||
<p>prints the value FEDC BA.</p> | <p>prints the value FEDC BA.</p> | ||
<p>$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.</p> | <p>$REVERSE is particularly useful when the file manager defines an [[Field design#ORDERED and NON-ORDERED attributes|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.</p> | ||
<p>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 *LY.</p> | <p>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 *LY.</p> | ||
<p>For more information on defining fields | <p>For more information on defining ORDERED fields, see [[Field design]]. </p> | ||
[[Category:SOUL $functions]] | [[Category:SOUL $functions]] |
Revision as of 18:21, 3 February 2016
The $REVERSE function reverses the order of a string.
Syntax
The format of the $REVERSE function is:
$REVERSE(string)
where string is any character string.
For example:
PRINT $REVERSE('AB CDEF')
prints the value FEDC BA.
$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 *LY.
For more information on defining ORDERED fields, see Field design.