You must use the
Property
option for an output field only if the payload response contains unique fields. If you have duplicate fields or a field with a list of simple type, there might be instances of one or more values with the same field name in the XML document. In that case, you must select
Expression
and use
XQuery
to get the correct field.
For example, assume that you select the
Property
option for the payload response as shown in the following sample:
<users>
<user1>
<ID>1</ID>
<ID>2</ID>
<ID>3</ID>
</user1>
<user2>
<ID>4</ID>
<ID>5</ID>
<ID>6</ID>
</user2>
<users>
When you use a field with a simple type and set the output as ID. Application Integration identifies an instance of the ID and returns a single output value such as the ID with the value as 4. However, if you use a field with a list of simple type, Application Integration finds the output instance. Then, Application Integration returns all the instances from the same level within the element. In this example, if the ID with value 1 in user 1 is identified, Application Integration also returns the IDs 2 and 3 within user 1.
To avoid this issue, when you have duplicate fields such as ID and you want to use the second ID from user 2, use
XQuery
to return the correct field as shown in the following sample:
.//user2/ID[2]/text()
Consider the following scenarios to use the sequence of values for the list of simple type variables:
If you have text output variables that contain a list of strings, to build a comma-separated string, use XQuery as shown in the following sample:
{string-join($TextsOut , ",")}
If you have a list of date-time values, and you want to access the second value from a list of dates, use XQuery as shown in the following sample:
{$DateTimesOut[2]}
If you want to iterate all the integers from the list of integer values, use XQuery as shown in the following sample:
{for $j in $Integers
return $j}