AppendFieldImages (Stringlist function): Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 59: | Line 59: | ||
<tr><th><var>NullValue</var></th> | <tr><th><var>NullValue</var></th> | ||
<td>This optional, name required, argument is a string</td></tr> | <td>This optional, name required, argument is a string that is a special value to be treated as a null when populating the target <var>Stringlist</var>. This is useful because storing nulls in fields is problematic on many fronts in <var class="product">Model 204</var>, so most sites have a special value that acts as a placeholder for a null. Without the <var>NullValue</var> argument, an application would have to go through the <var>Stringlist</var> items to find these placeholder values and convert them to real nulls. Obviously, this is tedious, error-prone and can be CPU intensive. | ||
<p> | |||
By specifying the <var>NullValue</var> argument to <var>AppendFieldImages</var>, this function will automatically convert the null placeholder to a real null. For example, if the string <code>_NULL_</code> is used to indicate a null value in a file, the following will convert all values of <code>_NULL_</code> to a null before populating the target <var>Stringlist</var>: </p> | |||
<p class="code">%rc = %sl:AppendFieldImages('ORDERINFO', NullValue='_NULL_') | |||
</p></td></tr> | |||
</table> | </table> | ||
Revision as of 22:10, 6 July 2012
Add fields stored in image format to a Stringlist (Stringlist class)
[Introduced in Sirius Mods 7.8]
This callable function retrieves fields that are in repeating groups into Stringlist items mapped to a User Language image.
AppendFieldImages is a Stringlist variant of $Field_ListI. AppendFieldImages has the same parameters as $Field_listI, except they are name required parameters.
Syntax
[%count =] sl:AppendFieldImages[( [Image= string], [FirstOccurrence= number], - [MaxOccurrences= number], - [Options= string], [NullValue= string])]
Syntax terms
%count | This numeric variable is the number of items (extracted repeating group occurrences) added to Stringlist sl, or it is one of these status codes:
| ||||||||
---|---|---|---|---|---|---|---|---|---|
sl | A Stringlist object. If empty, data is added to the end of the Stringlist. | ||||||||
Image | This optional, name required, argument is a string containing the name of an image and, optionally, an item in the image separated from the image name with a colon. The image and optional image item name can be separated with a blank from an optional fieldname prefix. If an image item name is specified, that item will be set to the occurrence number retrieved.
If this argument is not specified, or is null, or is simply a colon followed by an image item name, the image bound to Stringlist sl via BindImage is used as the mapping image. The specified image must have been defined with the NAMESAVE option. Also, the image is not allowed to have arrays, cannot have more than 255 items, and cannot be more than the maximum length of Stringlist items (2**31-1 bytes). The names of the image items in the specified image are mapped to fields in the current record context, and then the values of those fields are moved into the image. | ||||||||
FirstOccurrence | This optional, name required, argument is the first occurrence number of the repeating group to return. This defaults to 1, meaning that the first occurrence of the repeating group will be returned. | ||||||||
MaxOccurrences | This optional, name required, argument is the maximum number of occurrences of the repeating group to return. This defaults to 0, meaning that all occurrences of the repeating group, including and after the one specified by the FirstOccurrence argument, will be returned. | ||||||||
Options | This optional, name required, argument is a string that is a set of blank-delimited options to affect AppendFieldImages processing. The valid options are:
| ||||||||
NullValue | This optional, name required, argument is a string that is a special value to be treated as a null when populating the target Stringlist. This is useful because storing nulls in fields is problematic on many fronts in Model 204, so most sites have a special value that acts as a placeholder for a null. Without the NullValue argument, an application would have to go through the Stringlist items to find these placeholder values and convert them to real nulls. Obviously, this is tedious, error-prone and can be CPU intensive.
By specifying the NullValue argument to AppendFieldImages, this function will automatically convert the null placeholder to a real null. For example, if the string %rc = %sl:AppendFieldImages('ORDERINFO', NullValue='_NULL_') |
Usage notes
- For more information about images, see the User Language Manual.