$ListInfI: Difference between revisions
m (1 revision) |
mNo edit summary |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle"><section begin="desc" />Retrieve $list item into image<section end="desc" /></span> | <span class="pageSubtitle"><section begin="desc" />Retrieve $list item into image<section end="desc" /></span> | ||
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListInfI function is [[ | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListInfI function is the [[GetImage (Stringlist subroutine)]].</p> | ||
This function copies data from a specified $list item to an image. | This function copies data from a specified $list item to an image. | ||
The $ListInfI function accepts three arguments and returns a numeric result. It is a callable $function ( | The $ListInfI function accepts three arguments and returns a numeric result. It is a callable $function (see [[Calling Sirius Mods $functions]]). | ||
The first argument is a $list identifier. This is a required argument. | The first argument is a $list identifier. This is a required argument. | ||
Line 12: | Line 12: | ||
The second argument is the number of the item in the $list. This is a required argument. | The second argument is the number of the item in the $list. This is a required argument. | ||
The third argument can either be a string containing the name of an image or any image item from the required image. This is an optional argument if a image has been associated with the $list with a $ListImg | The third argument can either be a string containing the name of an image or any image item from the required image. This is an optional argument if a image has been associated with the $list with a [[$ListImg]] function. Otherwise, it is a required argument. | ||
==Syntax== | ==Syntax== | ||
<p class="syntax"><section begin="syntax" /> [%RESULT =] $ListInfI(list_identifier, item_num, image_id) | <p class="syntax"><section begin="syntax" /> [%RESULT =] $ListInfI(list_identifier, item_num, image_id) | ||
Line 20: | Line 21: | ||
<p class="caption">%RESULT is a number that indicates whether or not an error has occurred.</p> | <p class="caption">%RESULT is a number that indicates whether or not an error has occurred.</p> | ||
One way to extract a $list item into an image called 'HEADSTONE' is as follows : | |||
<p class="code"> %RC = $ListInfI(%LIST, %N, 'HEADSTONE') | <p class="code"> %RC = $ListInfI(%LIST, %N, 'HEADSTONE') | ||
</p> | </p> | ||
Line 27: | Line 28: | ||
<p class="code"> %RC = $ListInfI(%LIST, %N, %HEADSTONE:ID) | <p class="code"> %RC = $ListInfI(%LIST, %N, %HEADSTONE:ID) | ||
</p> | </p> | ||
The specific image item is irrelevant (as long as it is valid) in this call but is more efficient than specifying the image name in quotes because in the first example, the image name must be hashed and looked up (in NTBL) in each invocation of $ListInfI while in the second example, the hashing of the image name and lookup happens only once; at compile time. | The specific image item is irrelevant (as long as it is valid) in this call but is more efficient than specifying the image name in quotes because in the first example, the image name must be hashed and looked up (in NTBL) in each invocation of $ListInfI while in the second example, the hashing of the image name and lookup happens only once; at compile time. | ||
Line 37: | Line 39: | ||
%RC = $ListInfI(%LIST, %N) | %RC = $ListInfI(%LIST, %N) | ||
</p> | </p> | ||
In this last example, $ListImg associates the image with the $list, eliminating the need to specify the image name on the $ListInfI. This association is also useful in many other function calls in that it provides a structure to be associated with the $list that is useful for column oriented functions such as $ListFindI and $ListSrt.<p> | |||
In this last example, [[$ListImg]] associates the image with the $list, eliminating the need to specify the image name on the $ListInfI. This association is also useful in many other function calls in that it provides a structure to be associated with the $list that is useful for column oriented functions such as [[$ListFindI]] and [[$ListSrt]]. | |||
<p class="code"> | |||
0 - Data successfully copied | |||
-5 - Required argument not specified | -5 - Required argument not specified | ||
-6 - $List identifier invalid | -6 - $List identifier invalid | ||
Line 47: | Line 52: | ||
</p> | </p> | ||
<p class="code"> | <p class="code"> | ||
<ul class="smallAndTightList"> | <ul class="smallAndTightList"> | ||
<li>[[Sirius functions]]</li> | <li>[[Sirius functions]]</li> | ||
Line 57: | Line 61: | ||
<li>[[Japanese functions]]</li> | <li>[[Japanese functions]]</li> | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Sir2000 Field Migration Facility]]</li> | ||
</ul> | </ul> | ||
Line 63: | Line 66: | ||
<p class="caption">Products authorizing $ListInfI | <p class="caption">Products authorizing $ListInfI | ||
</p> | </p> | ||
[[Category:$Functions|$ListInfI]] | [[Category:$Functions|$ListInfI]] |
Revision as of 14:58, 10 February 2011
<section begin="desc" />Retrieve $list item into image<section end="desc" />
Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListInfI function is the GetImage (Stringlist subroutine).
This function copies data from a specified $list item to an image.
The $ListInfI function accepts three arguments and returns a numeric result. It is a callable $function (see Calling Sirius Mods $functions).
The first argument is a $list identifier. This is a required argument.
The second argument is the number of the item in the $list. This is a required argument.
The third argument can either be a string containing the name of an image or any image item from the required image. This is an optional argument if a image has been associated with the $list with a $ListImg function. Otherwise, it is a required argument.
Syntax
<section begin="syntax" /> [%RESULT =] $ListInfI(list_identifier, item_num, image_id) <section end="syntax" />
One way to extract a $list item into an image called 'HEADSTONE' is as follows :
%RC = $ListInfI(%LIST, %N, 'HEADSTONE')
A more efficient way of doing this would be
%RC = $ListInfI(%LIST, %N, %HEADSTONE:ID)
The specific image item is irrelevant (as long as it is valid) in this call but is more efficient than specifying the image name in quotes because in the first example, the image name must be hashed and looked up (in NTBL) in each invocation of $ListInfI while in the second example, the hashing of the image name and lookup happens only once; at compile time.
An even neater and equally efficient way of coding this would be
%RC = $ListImg(%LIST, %HEADSTONE:FNAME) . . . . . . %RC = $ListInfI(%LIST, %N)
In this last example, $ListImg associates the image with the $list, eliminating the need to specify the image name on the $ListInfI. This association is also useful in many other function calls in that it provides a structure to be associated with the $list that is useful for column oriented functions such as $ListFindI and $ListSrt.
0 - Data successfully copied -5 - Required argument not specified -6 - $List identifier invalid -7 - Item number not found in $list -8 - Image not found or not active