$ListLup: Difference between revisions
mNo edit summary |
(Automatically generated page update) |
||
(12 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Locate string in $list, searching backwards</span> | <span class="pageSubtitle">Locate string in $list, searching backwards</span> | ||
<p class="warn"><b>Note: </b> | <p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListLup function is <var>[[LocateUp (Stringlist function)|LocateUp]]</var>.</p> | ||
This function locates a specified string in a $list, searching the $list items in reverse order. | This function locates a specified string in a $list, searching the $list items in reverse order. | ||
Line 32: | Line 32: | ||
<li>The sixth argument is an indicator for case-insensitive comparisons. If this argument is a non-zero integer, the string comparisons use $list item data translated to uppercase (hence your search string should be passed as an uppercase value). This is an optional argument and defaults to zero. If the sixth argument is 1, then the width of the column range is reduced to a maximum of 256. | <li>The sixth argument is an indicator for case-insensitive comparisons. If this argument is a non-zero integer, the string comparisons use $list item data translated to uppercase (hence your search string should be passed as an uppercase value). This is an optional argument and defaults to zero. If the sixth argument is 1, then the width of the column range is reduced to a maximum of 256. | ||
<li>The seventh argument, available | <li>The seventh argument, available as of <var class="product">Sirius Mods</var> 8.1, is an indicator for arbitrary blank matching. If this argument is a non-zero integer, single (') and double (") quotes are treated as matches for each other. This can be useful when searching through procedures that contain code where single and double quotes can be used interchangeably to enclose string literals. Such code includes User Language, Javascript, and XML (including XSLT). This is an optional argument and defaults to 0. If the seventh argument is non-zero, then the width of the column range is reduced to a maximum of 256. | ||
</ul> | </ul> | ||
===Error codes=== | ===Error codes=== | ||
<p class="code">-5 - Required argument not specified | |||
-6 - $List identifier invalid | -6 - $List identifier invalid | ||
-7 - Item number not found in $list | -7 - Item number not found in $list | ||
Line 78: | Line 78: | ||
==Products authorizing {{PAGENAMEE}}== | ==Products authorizing {{PAGENAMEE}}== | ||
<ul class="smallAndTightList"> | <ul class="smallAndTightList"> | ||
<li>[[Sirius functions]]</li> | <li>[[List of $functions|Sirius functions]]</li> | ||
<li>[[Fast/Unload User Language Interface]]</li> | <li>[[Fast/Unload User Language Interface]]</li> | ||
<li>[[Janus Open Client]]</li> | <li>[[Media:JoclrNew.pdf|Janus Open Client]]</li> | ||
<li>[[Janus Open Server]]</li> | <li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li> | ||
<li>[[Janus Sockets]]</li> | <li>[[Janus Sockets]]</li> | ||
<li>[[Janus Web Server]]</li> | <li>[[Janus Web Server]]</li> | ||
<li> | <li>Japanese functions</li> | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li> | ||
</ul> | </ul> | ||
[[Category:$Functions|$ListLup]] | [[Category:$Functions|$ListLup]] |
Latest revision as of 22:51, 20 September 2018
Locate string in $list, searching backwards
Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListLup function is LocateUp.
This function locates a specified string in a $list, searching the $list items in reverse order.
The $ListLup function accepts six arguments and returns a numeric result.
Syntax
%result = $ListLup(list_identifier, [start], [search_string], - [start_col], [end_col], [case_ignore], [arb_quote])
%result is set to the item number of the first item in the $list going backwards from the starting item number that matches the search criteria, or it is set to a negative number if an error has occurred.
- The first argument is the identifier of the $list in which a string is to be located. This is a required argument.
- The second argument is the item number at which the search is to begin. If this argument is not specified searching begins at the last item in the $list.
- The third argument is the string to be located. If this argument is not specified, all $list items are considered to contain the search string.
- The fourth argument is a number that specifies the starting column of a range of columns in which the search string must be located or a string containing the name of an image item in the image associated with the $list using $ListImg. In the latter case, the start column for the search is the position of the image item in the image. This is an optional argument and defaults to 1.
- The fifth argument is a number that specifies the ending column of a range of columns in which the search string must be located. This is an optional argument and defaults to one of the following values:
- if the fourth argument specifies an image item name, the position of the end of the image item in the image
- otherwise, 6124
If the sixth argument or seventh is a non-zero integer, then the width of the column range is reduced to a maximum of 256.
- The sixth argument is an indicator for case-insensitive comparisons. If this argument is a non-zero integer, the string comparisons use $list item data translated to uppercase (hence your search string should be passed as an uppercase value). This is an optional argument and defaults to zero. If the sixth argument is 1, then the width of the column range is reduced to a maximum of 256.
- The seventh argument, available as of Sirius Mods 8.1, is an indicator for arbitrary blank matching. If this argument is a non-zero integer, single (') and double (") quotes are treated as matches for each other. This can be useful when searching through procedures that contain code where single and double quotes can be used interchangeably to enclose string literals. Such code includes User Language, Javascript, and XML (including XSLT). This is an optional argument and defaults to 0. If the seventh argument is non-zero, then the width of the column range is reduced to a maximum of 256.
Error codes
-5 - Required argument not specified -6 - $List identifier invalid -7 - Item number not found in $list -8 - String not found (if $list empty, -7) -9 - Invalid column range
Examples
- The following code locates a string anywhere in a $list item, searching backwards starting at item 100.
%NUM = $ListLup(%LIST, 100, 'VIETNAMERICA')
- In the following code, an image is associated with the $list, items are added to the $list from the image and then the $list is searched backwards from the last item for an item that contains a particular value in the columns associated with a specific image item.
IMAGE CUST LNAME IS STRING LEN 30 FNAME IS STRING LEN 30 ID IS STRING LEN 9 END IMAGE PREPARE IMAGE CUST %LIST = $ListNew %RC = $ListImg(%LIST, %CUST:LAME) . . . FOR EACH RECORD IN LCUST . . . %RC = $ListAddI(%LIST) . . . END FOR . . . %ITEMNUM = $ListLup(%LIST, , %LOCID, 'ID')