ELEMENT

ELEMENT

Top  Previous  Next

 

The ELEMENT keyword prefixes a data collection element path when processing a collection file.

 

 

Format

 

ELEMENT path

 

where

 

pathis the data collection element path. This may need to be enclosed in single or double quotes to avoid syntactic ambiguity.

 

 

The ELEMENT keyword allows a data collection element to be referenced by element path on the command line in much the same way as a field can be referenced using An or Fn instead of by name. It may be used in the selection, sort or display clauses.

 

The path may include an asterisk in a position that corresponds to an array in the data collection. This will result in a multivalued result where each value corresponds to an array element. For example, a simple sales order record might have an element named "detail" which is an array where each element is a further collection with elements "prodno" and "qty". Use of

ELEMENT "detail/*/prodno"

would reference a multivalued list of product numbers in the order.

 

Taking this example further, it may be necessary to store the serial numbers of each item sold as an array named "serial" that is stored as a third element in the detail collection. Use of

ELEMENT "detail/*/serial/*"

would reference data in which there is a value for each product and a subvalue for each serial number.

 

The default display characteristics used for an ELEMENT item in the absence of a field qualifiers treat it as 10 characters left justified, single valued and use the element path as the column heading.

 

 

See also:

AS, Data collections