Previous: Selection Expressions, Up: Common Options


18.2 Field Expressions

Field expressions (also known as FEXs) are a way to select fields of a record.

A FEX is composed by a sequence of elements separated by commas:

     ELEM_1,ELEM_2,...,ELEM_N

Each element makes a reference to one or more fields in a record identified by a given name and an optional subscript:

     Field_Name[min-max]

min and max are zero-based indexes. It is possible to refer to a field occupying a given position. For example, consider the following record:

     Name: Mr. Foo
     Email: foo@foo.com
     Email: foo@foo.org
     Email: mr.foo@foo.org

We would select all the emails of the record with:

     Email

The first email with:

     Email[0]

The third email with:

     Email[2]

The second and the third email with:

     Email[1-2]

And so on. Note that a selection is an ordered set not allowing duplicated values. Thus, the field expression:

     Email[0],Name,Email

is equivalent to

     Email[0],Name,Email[1-2]