Introduction
In Oracle Integration Cloud (OIC), sometimes the source contains multiple Impacted Account IDs, and the same Account ID may appear more than once.
This XPath helps to:
- Collect all Account IDs
- Convert them into a delimited string
- Convert them back into nodes
- Remove duplicate values using distinct-values()
- Create a unique list for the target Accounts field
XPath Used
distinct-values(
oraext:create-nodeset-from-delimited-string(
"dvs",
oraext:create-delimited-string(
/nssrcmproexecute/ns15:request-wrapper/ns15:ImpactedAccountID,
","
)
)
)
How It Works
1. create-delimited-string()
oraext:create-delimited-string(
/nssrcmproexecute/ns15:request-wrapper/ns15:ImpactedAccountID,
","
)
This takes multiple ImpactedAccountID values and combines them using a comma.
Input:
1001
1002
1001
1003
Result:
1001,1002,1001,1003
2. create-nodeset-from-delimited-string()
oraext:create-nodeset-from-delimited-string(
"dvs",
"1001,1002,1001,1003"
)
This converts the comma-separated values back into individual nodes.
3. distinct-values()
distinct-values(...)
This removes duplicate values.
Result:
1001
1002
1003
Example
Source
<ImpactedAccountID>1001</ImpactedAccountID>
<ImpactedAccountID>1002</ImpactedAccountID>
<ImpactedAccountID>1001</ImpactedAccountID>
<ImpactedAccountID>1003</ImpactedAccountID>
Target
<Accounts>
<AccountId>1001</AccountId>
<AccountId>1002</AccountId>
<AccountId>1003</AccountId>
</Accounts>
Why Use This XPath?
This approach is useful when the target requires unique repeating Account IDs and the source may contain duplicate values.
In Simple Words
Source → Combine IDs → Split them again → Remove duplicates → Map unique IDs to target
This is especially useful in OIC when handling repeating elements and avoiding duplicate records in the target request.


No comments:
Post a Comment