$ListInfI: Difference between revisions
m (1 revision) |
m (1 revision) |
||
Line 15: | Line 15: | ||
==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) | ||
<section end="syntax" /></p> | <section end="syntax" /></p> | ||
<p class="caption">$ListInfI Function | <p class="caption">$ListInfI Function |
Revision as of 20:32, 24 October 2012
Retrieve $list item into image
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