$ListSavL: Difference between revisions
(→Syntax) |
m (minor wordsmithing) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Count and names of available global $lists</span> | <span class="pageSubtitle">Count and names of available global $lists</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 $ListSavL function is the [[PersistentObjectInfo class]] which returns information about [[Global and session objects|global and session objects]] allocated to a thread.</p> | ||
This function retrieves the count of items in, and names of, the [[$lists]] | This [[Calling Sirius Mods $functions|callable]] function retrieves the count of items in, and names of, the [[$lists]] for which both of these are true: | ||
<ul> | |||
<li>Saved by the <var>$List_Global</var>, <var>$ListSav</var>, or <var>$ListSave</var> function </li> | |||
<li>Not, in the current request, restored by <var>$ListRst</var> </li> | |||
</ul> | |||
The | The <var>$ListSavL</var> function accepts one argument and returns a numeric error code. | ||
==Syntax== | ==Syntax== | ||
Line 14: | Line 17: | ||
</p> | </p> | ||
< | <ul> | ||
<li><var class="term">%result</var> is a non-negative number indicating the number of saved $lists, or it is a negative error code.</li> | |||
<li><var class="term">list_identifier</var> is the identifier of the $list that is to receive the results. The current contents of the $list are deleted and replaced with the item count and names of available saved $lists. | |||
<p> | |||
Each $list item contains the 10-digit number of items, followed by a blank, followed by the name of a global $list not yet restored by <var>$ListRst</var> in the current <var class="product">SOUL</var> request. </p></li> | |||
</ul> | |||
===Return codes=== | ===Return codes=== | ||
<p class="code">-3 | <p class="code">>=0 – Number of suitable saved $lists found | ||
-5 | -3 – Not enough room to store list of counts and names | ||
-6 | -5 – Required argument not specified | ||
-6 – Invalid $list identifier | |||
</p> | </p> | ||
Latest revision as of 18:28, 11 April 2016
Count and names of available global $lists
Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListSavL function is the PersistentObjectInfo class which returns information about global and session objects allocated to a thread.
This callable function retrieves the count of items in, and names of, the $lists for which both of these are true:
- Saved by the $List_Global, $ListSav, or $ListSave function
- Not, in the current request, restored by $ListRst
The $ListSavL function accepts one argument and returns a numeric error code.
Syntax
[%result =] $ListSavL(list_identifier)
- %result is a non-negative number indicating the number of saved $lists, or it is a negative error code.
- list_identifier is the identifier of the $list that is to receive the results. The current contents of the $list are deleted and replaced with the item count and names of available saved $lists.
Each $list item contains the 10-digit number of items, followed by a blank, followed by the name of a global $list not yet restored by $ListRst in the current SOUL request.
Return codes
>=0 – Number of suitable saved $lists found -3 – Not enough room to store list of counts and names -5 – Required argument not specified -6 – Invalid $list identifier
Example
The following procedure uses $ListSav to save information in various lists, and uses $ListSavL and $ListRst to display the saved lists:
B ... %RESULT = $ListSav(%LIST, 'name') ... END CLOSE ALL B %SAVED = $ListNew %RESULT = $ListSavL(%SAVED) FOR %I FROM 1 TO $ListCnt(%SAVED) %N = $ListInf(%SAVED, %I, 1, 10) %NAME = $ListInf(%SAVED, %I, 12) PRINT %N ' items in ' %NAME ':' %LIST = $ListRst(%NAME) FOR %J FROM 1 TO %N PRINT $ListInf(%LIST, %J) END FOR END FOR END