Accessing multiple occurrences of an element in a message in the MRM domain
You can use specific ESQL code to set the value of one occurrence of an element that has multiple occurrences in a message. You can also use arrow notation to indicate the direction of search when searching for multiple occurrences of an element.
About this task
You can access MRM domain elements following the general guidance given in Accessing known multiple occurrences of an element and Accessing unknown multiple occurrences of an element. Further information specific to MRM domain messages is provided in this topic.
Consider the following statements:
DECLARE brw NAMESPACE 'http://www.ibm.com/Borrowed';
SET OutputRoot.MRM.brw:Borrowed[1].VideoTitle = 'MRM Greatest Hits Volume 1';
SET OutputRoot.MRM.brw:Borrowed[2].VideoTitle = 'MRM Greatest Hits Volume 2';
The above SET statements operate on two occurrences of the element Borrowed. Each statement sets the value of the child VideoTitle. The array index indicates which occurrence of the repeating element you are interested in.
When you define child elements of a complex type (which has its Composition property set to Sequence) in a message set, you can add the same element to the complex type more than once. These instances do not have to be contiguous, but you must use the same method (array notation) to refer to them in ESQL.
StringElement1
IntegerElement1
StringElement1
use the following ESQL to set the value of StringElement1
:
SET OutputRoot.MRM.StringElement1[1] =
'This is the first occurrence of StringElement1';
SET OutputRoot.MRM.StringElement1[2] =
'This is the second occurrence of StringElement1';
You can also use the arrow notation (the greater than (>) and less than (<) symbols) to indicate the direction of search and the index to be specified:
SET OutputRoot.MRM.StringElement1[>] =
'This is the first occurrence of StringElement1';
SET OutputRoot.MRM.StringElement1[<2] =
'This is the last but one occurrence of
StringElement1';
SET OutputRoot.MRM.StringElement1[<1] =
'This is the last occurrence of StringElement1';
Refer to Accessing known multiple occurrences of an element and Accessing unknown multiple occurrences of an element for additional detail.