array references

array references


dynamic array Index Level array.variable
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>
Category BASIC
Type Definition
Description dimensioned and dynamic arrays may be referenced in FlashBASIC 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".

D3 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.
Options
See Also ac.expression MATWRITE READ MATREAD DIM LT REPLACE > vc.expression num.expression < assignment dimensioned array WRITE dynamic array sc.expression INSERT LOCATE array.variable EXTRACT ( ) *
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".
Warnings Referencing attribute "0" (zero) in a dynamic array always returns a null string.

R83 does not support the "*" (wildcard) array reference.
Compatibility D3 7.0 AP R83
dynamic array Index Level array.variable