Author |
Message
|
bdaoust |
Posted: Wed Oct 21, 2015 12:10 pm Post subject: XML to XML Nested Mapping Transform - XML Element Missing |
|
|
Centurion
Joined: 23 Sep 2010 Posts: 130
|
Hi all:
I have a map that does a For Each transformation within an XML sequence.
Basically for each for each - it evaluates short description and tranforms to the matching element on the output of the map.
Example:
If shortdescription = 'Yellow" >>>> transform to XML Element "TotalYellow"
If shortdescription = "Blue" >>>>> transform (move) to XML element "TotalBliue"
During the map - some colors may be missing, but I need to maintain the XML Output structure, so output elements I set Nillable to 'true'
So I did a simple test where I had a Yellow but not Blue. The output I got TotalYellow XML element, but I did not get TotalBlue even though I set it to nullable.
For giggles I removed the Blue transform/condition from the map - redeployed - and got the TotalBlue (blank element) which is what I want.
So seems like even if the output element is set to nillable - if I have a transformed wire to element in a map and the condition isn't mapped - I don't get the XML elelemt.
Any ideas? |
|
Back to top |
|
 |
bdaoust |
Posted: Wed Oct 21, 2015 12:32 pm Post subject: |
|
|
Centurion
Joined: 23 Sep 2010 Posts: 130
|
Just did another test were i had a single XML element mapped to another single XML element, so no for each stuff going on.
The input had a null value and I did get the resulting XML element.
Appears to be something within the For/Each - If transforms.
Thanks |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Oct 21, 2015 12:45 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You need to conduct the mapping inside the foreach submap (I'm sure you know that).
Then you need to conduct each individual mapping with an if that checks the existance, or a default value (whatever mapping calls those). _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
bdaoust |
Posted: Wed Oct 21, 2015 4:19 pm Post subject: |
|
|
Centurion
Joined: 23 Sep 2010 Posts: 130
|
Ya, I'm doing submaps.
For Each >> IF >>> Move
Where I'm stuck is that if IF is false, then I still want to Move to that element (TotalBlue) with a null value.
So I need to do this in the second submap I would think.
I see I can do custom ESQL, but is that overkill?
Recommendations? |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Oct 22, 2015 5:11 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You wouldn't need a submap?
Just an ELSE clause? _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
bdaoust |
Posted: Thu Oct 22, 2015 10:33 am Post subject: |
|
|
Centurion
Joined: 23 Sep 2010 Posts: 130
|
I ended up just created a proper DFDL with a header and a record. In the header, I just made each element's default value be equal to the element's name. Getting what I need now.
Found some good labs on message modeling.
Wish the classes I took did more hands on labs. I one of those people that learns by example and many mistakes!  |
|
Back to top |
|
 |
|