GetImage (Stringlist subroutine): Difference between revisions
Jump to navigation
Jump to search
m (→Examples) |
|||
Line 20: | Line 20: | ||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>All errors in <var>GetImage</var> result in request cancellation. | <li>All errors in <var>GetImage</var> result in request cancellation.</li> | ||
<li>Stringlist items longer than the target image are silently truncated.</li> | |||
<li>Stringlist items shorter than the target image do not modify the image contents beyond the Stringlist item length. As such, if GetImage is used with varying length Stringlist items, the images can contain "leftover" data after a GetImage. If this is a concern, a [[Images#PREPARE_statement|Prepare Image]] should be done before each GetImage invocation.</li> | |||
</ul> | </ul> | ||
Revision as of 14:03, 14 August 2014
Retrieve Stringlist item into image (Stringlist class)
This method copies data from a specified Stringlist item to an Image.
Syntax
sl:GetImage( itemNum, [imageName])
Syntax terms
sl | A Stringlist object. |
---|---|
itemNum | The number of the item in the Stringlist. |
imageName | A string that contains the name of an Image. This is an optional argument if an image has already been associated with the Stringlist via BindImage. Otherwise, it is a required argument. This argument is case sensitive. That is, in the likely event the User Language was written in mixed case, with automatic uppercasing in effect (see "Mixed-case User Language") the image name should be in uppercase. |
Usage notes
- All errors in GetImage result in request cancellation.
- Stringlist items longer than the target image are silently truncated.
- Stringlist items shorter than the target image do not modify the image contents beyond the Stringlist item length. As such, if GetImage is used with varying length Stringlist items, the images can contain "leftover" data after a GetImage. If this is a concern, a Prepare Image should be done before each GetImage invocation.
Examples
- One way to extract a Stringlist item into an image (called
Headstone
, below) is as follows:%list:getImage(%n, 'HEADSTONE')
- Here is a neater and more efficient way of doing this:
%list:bindImage('HEADSTONE') ... %list:getImage(%n)
In this last example, BindImage associates the image with the Stringlist, eliminating the need to specify the image name on the GetImage.