basic.array.references
Referencing arrays.
Syntax
array.variable(ac.expression) array.variable(row.number,col.number) array.variable(adi) dynamic.array.variable<ac.expression> dynamic.array.variable<ac.expression, vc.expression> dynamic.array.variable<ac.expression, vc.expression, sc.expression>
Description
dimensioned and dynamic arrays may be referenced in Pick/BASIC programs.
Dimensioned array references have the form:
array.variable(num.expression)
-or-
array.variable(num.expression, num.expression)
Dimensioned arrays have a maximum of two dimensions and must first be defined with a 'dim' or 'dimension' statement.
When used in conjunction with the 'file' statement, dimensioned array elements may be referenced by the actual item-id of the attribute-defining item (adi) in the associated dictionary:
file entity
.
.
if fv.entity(name) = '' then
Dynamic (or 'string') array references have the forms:
1) dynamic.array.variable<ac.expression>
This form references an entire attribute location of a dynamic array.
2) dynamic.array.variable<ac.expression, vc.expression>
This form references a value within an attribute.
3) dynamic.array.variable<ac.expression, vc.expression, sc.expression>
This form references a subvalue within a value.
Combining dimensioned and dynamic array elements:
A specific value or subvalue of a dimensioned array can be specified using the following forms:
array(ac.expression)<ac.expression, vc.expression>
This references the element of the dimensioned array derived from the current value of 'ac.expression'. Within this array element, the value count derived from 'vc.expression' is referenced.
array(ac.expression)<ac.expression, vc.expression, sc.expression>
As in the previous case, with the additional reference to a subvalue location derived from 'sc.expression'.
Advanced Pick also allows every element within either type of array to be compared using an '*' as a wildcard character. The position of the '*' determines which element is searched.
Example
customer.item(1) = name
This assigns the value of 'name' to the first element of the
dimensioned array 'customer.item'.
customer.item<2,2> = address2
This assigns the value of 'address2' to the second value in the
second attribute of dynamic array 'customer.item'.
if array(*) = 'x' then...
This searches for any element in the dimensioned array 'array' equal
to the letter 'x'.
if customer.item<2,*> = '' then...
This searches for any value of attribute 2 in the dynamic array
'customer.item' equal to null string ('').
if customer.item<*,*,*> = '' then...
This searches for any subvalue in any value in any attribute in the dynamic
array 'customer.item' that is equal to a null string ('').
if array<*,1,*> = 'xxx' then...
This searches for any subvalue in value 1 in any attribute in the dynamic array
'array' that is equal to 'xxx'.
See Also
User Comments
What do you think?
Share your experience or ask a question by using the form below.
Login to leave your comments.
