AddImage (Stringlist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
Line 8: Line 8:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th><var class="syntax">%number</var></th>
<tr><th><var class="syntax">%number</var></th>
<td>A numeric variable to contain the number of items in the indicated <var>Stringlist</var> after the string has been added to the <var>Stringlist</var>. <var class="syntax">%number</var> is also the item number associated with the added string in the <var>Stringlist</var>.</td></tr>
<td>A numeric variable to contain the number of items in the indicated <var>Stringlist</var> after the string has been added to the <var>Stringlist</var>. <var class="term">%number</var class="term"> is also the item number associated with the added string in the <var>Stringlist</var>.</td></tr>
<tr><th>sl</th>
<tr><th>sl</th>
<td>A <var>Stringlist</var> object.</td></tr>
<td>A <var>Stringlist</var> object.</td></tr>
Line 23: Line 23:


<p class="code">image cust
<p class="code">image cust
name is string len 20
  name is string len 20
ssn is string len 10
  ssn is string len 10
bdate is string len 8
  bdate is string len 8
end image
end image
...
...
find records to %recset
find records to %recset
name = smith
  name = smith
end find
end find
...
...
Line 36: Line 36:


for each record in %recset
for each record in %recset
%cust:name = name
  %cust:name = name
%cust:ssn = ssn
  %cust:ssn = ssn
%cust:bdate = bdate
  %cust:bdate = bdate
%count = %list:addImage('CUST')
  %count = %list:addImage('CUST')
end for
end for
</p>
</p>
Line 47: Line 47:
<p class="code">%list:bindImage('CUST')
<p class="code">%list:bindImage('CUST')
for each record in %recset
for each record in %recset
%cust:name = name
  %cust:name = name
%cust:ssn = ssn
  %cust:ssn = ssn
%cust:bdate = bdate
  %cust:bdate = bdate
%count = %list:addImage
  %count = %list:addImage
end for
end for
</p>
</p>

Revision as of 23:48, 24 January 2011

Add image as new Stringlist item (Stringlist class)


This callable method copies data from an image to a Stringlist. The AddImage method accepts one argument and returns a numeric result.

Syntax

[%number =] sl:AddImage[( [imageName])]

Syntax terms

%number A numeric variable to contain the number of items in the indicated Stringlist after the string has been added to the Stringlist. %number is also the item number associated with the added string in the Stringlist.
sl A Stringlist object.
imageName A string that contains the name of an image or of any image item from the required image. This argument is optional if an image has been associated with the Stringlist by a BindImage (Stringlist function). Otherwise, it is a required argument.

Usage notes

All errors result in request cancellation.

Examples

The following example demonstrates how AddImage might be used:

image cust name is string len 20 ssn is string len 10 bdate is string len 8 end image ... find records to %recset name = smith end find ... %list is object stringList %list = new for each record in %recset %cust:name = name %cust:ssn = ssn %cust:bdate = bdate %count = %list:addImage('CUST') end for

A more efficient way of coding the For Each Record Loop is:

%list:bindImage('CUST') for each record in %recset %cust:name = name %cust:ssn = ssn %cust:bdate = bdate %count = %list:addImage end for

In this last example, the BindImage (Stringlist function) associates the image with the Stringlist, eliminating the need to specify the image name on the AddImage invocation.