Data type: Structure

The Structure data type is a compound data type represented by the number 9 in the database dictionary. A structure is a group of named elements of (possibly) differing data types accessed by an index (element) number. Structures are delimited with both curly braces and square brackets ({[ ]}). Note the following examples:

  • {[1,"a",true]}
  • {[true,‘10/16/90 00:00’,false]}
  • {[1,1,"b",0]}

You can use either of the following syntaxes to extract an element from a structure:

  • $structure[index of field]
  • index of field in $structure

For example, to extract the value of the part number (672) in the part.no field within the structure $order.line1 with the value of {[672,10,"ball.bearings"]} with the field names part.no, quantity and description, use either of the following syntaxes:

  • $order.line1[1]
  • 1 in $order.line1

In addition, elements of structures may be extracted using their numeric order in the structure . For example, the 1 in $order.line1 is the same as part.no in $order.line1.

Field names are contained in the database dictionary and can only be used when associated with a file variable.

Assuming that the table contains a structure called part and within the structure and there is field called part.no, this command works because it is associated with a file variable.

$x=part,part.no in $file

These commands do not work because the second command is not associated with a file variable.

$y=part in $file
$x=part.no in $y