FIELDNAME function
The FIELDNAME field function returns the name of a given field.
Syntax
FIELDNAME returns the name of the field identified by source_field_reference as a character value. If the parameter identifies a nonexistent field, NULL is returned.
For example:
FIELDNAME(InputRoot.XMLNS)
returns XMLNS.FIELDNAME(InputBody)
returns the name of the last child of InputRoot, which could be XMLNS.FIELDNAME(InputRoot.*[<])
returns the name of the last child of InputRoot, which could be XMLNS.
This function does not show any namespace information; this must be obtained by a separate call to the FIELDNAMESPACE function.
Whereas the following
ESQL sets X to "F1":
SET X=FIELDNAME(InputBody.*[<]);
The
following ESQL sets Y to null: SET Y=FIELDNAME(InputBody.F1.*[<]);
However,
the following ESQL sets Z to the (expected) child of F1:
SET Z=FIELDNAME(InputBody.*[<].*[<]);
This
is because F1 belongs to a namespace and needs to be explicitly referenced
by, for example:
DECLARE ns NAMESPACE 'urn:nid:xxxxxx';
SET Y=FIELDNAME(InputBody.ns:F1.*[<]);