on 2025 Apr 09 9:52 AM
Hi expterts,
I am trying to merge several single values into one structure using an UDF with the addContextChange function.
Unfortunately it does not work as expected.
My source structure look similar to this all with occurence 0..1:
[...]
costCenter1
costCenter2
costCenter3
percentage1
percantage2
percentage3
[...]
Inside the target message I would like to group them in a structure like this:
[...]
costDistribution (0..*)
- costCenter (1..1)
- percentage (1..1)
[...]
To map the values I am using an UDF function:
def void costDistribution(String[] costCenter1, String[] costCenter2, String[] costCenter3, String[] percentage1, String[] percentage2, String[] percentage3, Output parentNode, Output costCenters, Output percentages, MappingContext context){ ... }
For test purposes I tried this with static values to get a feeling for the context change function and tried this:
parentNode.addValue("004025235")
costCenters.addValue("004025235")
percentages.addValue("80")
parentNode.addContextChange()
costCenters.addContextChange()
percentages.addContextChange()
parentNode.addValue("004025240")
costCenters.addValue("004025240")
percentages.addValue("20")
My expection in the target would be to have several costDistribution nodes with the corresponding values like this:
[...]
costDistribution
- costCenter 004025235
- percentage 80
costDistribution
- costCenter004025240
- percentage 20
[...]
In Reality the first block is generated. May someone explain me how I need to use the contextChange function to achieve the wanted structure?
Thank you all in advance.
Best regards
Request clarification before answering.
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 6 | |
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.