The CARDINALITY field function returns the number of repeating fields in a given array.
CARDINALITY returns an integer value giving the number of repeating fields in the array specified by field_reference. If field_reference identifies a nonexistent field, zero is returned.
Body.Invoice."Item"[CARDINALITY(Body.Invoice."Item"[]) - 2].Quantity
In this example, the CARDINALITY function is passed a field reference that ends in []. The meaning of this is count all instances of the Item field. The [] at the end is required; it makes the syntax consistent with other instances where it is necessary to refer to all instances of something. Array indices start at 1, so the array index in the above example refers to the third-from-last instance of the Item field.
Related concepts
ESQL
Related tasks
Developing ESQL
Converting code page and message encoding
Related reference
Syntax preference
ESQL field functions
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
ak05530_ |