$Reverse: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
 
m (misc cleanup)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<p>The $REVERSE function reverses the order of a string. </p>
<p>
The <var>$Reverse</var> function reverses the order of a string. </p>
<b>Syntax</b>
<b>Syntax</b>
<p>The format of the $REVERSE function is:</p>
<p>
<p class="code">$REVERSE(string)  
The format of <var>$Reverse</var> is:</p>
<p class="syntax">$Reverse(<span class="term">string</span>)  
</p>
</p>
<p>where string is any character string. </p>
<p>
<p>For example:</p>
where <var class="term">string</var> is any character string. </p>
<p class="code">PRINT $REVERSE('AB CDEF')  
<p>
For example:</p>
<p class="code">Print $Reverse('AB CDEF')  
</p>
</p>
<p>prints the value FEDC BA.</p>
<p>prints the value <code>FEDC BA</code>.</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>
<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>
<var>$Reverse</var> is particularly useful when the file manager defines an <var>[[Field design#ORDERED and NON-ORDERED attributes|ORDERED]]</var> field to contain the characters of a frequently retrieved field in reverse order. Thus, when leading wildcard patterns (for example, <code>*SON</code>) 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 more information on defining fields to optimize leading wildcard patterns, refer to the Rocket <var class="product">Model&nbsp;204</var> File Manager's Guide. </p>
<p>
For example, an <var>ORDERED</var> field named <code>WORD</code> exists, and values ending in <code>LY</code> are to be retrieved frequently. To optimize this retrieval, another <var>ORDERED</var> field named <code>REVERSE.WORD</code> can be defined to store the reversed values in the <code>WORD</code> field, and the pattern <code>*LY</code> can be reversed to retrieve values in <code>REVERSE.WORD LIKE 'YL*'</code>. The pattern <code>YL*</code> optimizes the Ordered Index retrieval, providing much faster performance than <code>*LY</code>.</p>
 
[[Category:SOUL $functions]]
[[Category:SOUL $functions]]

Latest revision as of 18:23, 12 July 2017

The $Reverse function reverses the order of a string.

Syntax

The format of $Reverse 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.