Accessing composites from within scripts

The value of a component of a composite field can be specified or referenced from within a script. SanScript has two methods of referencing components.

Component addressing using a colon

A colon (:) is the common way to reference components of standard composites. It can also be used to address components of extended composites. The syntax for this type of referencing is composite field name:component field name. The colon separates the composite field name and the component field name.

Example

The following script assigns the values shown in Example 1 to the Item Number composite field.

'Item Number:Vendor Code' = "GPS";
'Item Number:Part Number' = 1151;

Component addressing by offset

Component addressing by offset can be used for both standard and extended composites. This type of addressing is similar to referencing the elements of an array. The components of a composite are numbered from 1 to n, with n being the total number of components in the composite. A specific component is addressed by its location in the composite, as shown in the following examples.

Example

The following example sets the local variable l_company to the value of the second component of the Part Number composite field.

local string l_company;

l_company = component(2) of field 'Part Number';

Example

The following example clears all 12 components of the Account Number field.

local integer index;

for index equals 1 to 12 do
	component(index) of field 'Account Number' = "";
end for;


Documentation Feedback