cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Message mapping: How to handle empty parent node in source structure?

SebS
Discoverer
0 Kudos
150

I am trying to do some message mapping but i am running into a serious problem with inconsistent data. Let me show an example:

<ROOT><Users><User><DataTop><DataMiddle><DataBottom>This is the value i need<DataBottom><DataMiddle><DataTop><User><Users><ROOT>

My mapping would just take the value from DataBottom and map it to whatever. The XML i work with has several User inside the Users tag. But sometimes a User is different, like this:

<User><DataTop><DataTop><User>

This is where the mapping gives me trouble. When trying to map DataBottom, this would just be skipped for this user, which would give incorrect data for all the following users completely ruining all my data. After some searching i found out that this is supposed to work like this due to the queues. 

How can i work around this? If one of the parent nodes is empty, i need to set a default value. I tried with some node functions, but they all get ignored on the DataBottom node, probably because that node cannot be reached when DataTop and DataMiddle do not exist.

Accepted Solutions (1)

Accepted Solutions (1)

alex_bundschuh
Product and Topic Expert
Product and Topic Expert
0 Kudos

you need to add a context change, either check if setting the context of the source field will do the trick or add a context change using function SplitByValue

Alex

SebS
Discoverer
0 Kudos
While this fixed the issue, it still took some time for me to figure out what exactly your answer means. So whoever is as confused as i am: when mapping a value it requires for all the parent nodes in the given XML data to be available. If you are mapping down some children nodes but a node is missing, the mapping for your wanted node will simply be skipped. A method like splitByValue will be no help. What needs to be done is to select the source node, click the three dots and click on Contexts. Then you can define a new start for the Context, which ideally will be a parent node that 100% exists in your source data. Only then will the source field not be skipped.

Answers (0)