cancel
Showing results for 
Search instead for 
Did you mean: 

Message Mapping: Parent should only appear if child exists

udo_martens
Active Contributor
0 Kudos

Hi,

i have a message structure like

root
   structure 0-unbounded
      field1    0-1
      field2    0-1

I want to create the same output structure, but if field1 doent exist, the parent structure shouldnt appear. Sounds very simple, but the my problem is: however i map field1 to structure, either directly or with functions like exists() or ifWithOutElse() it allways give me the wrong structure.

For example:

<root>
   <structure>
      <field2>10</field2>
   </structure>
   <structure>
      <field1>20</field1>
      <field2>30</field2>
   </structure>
   <structure>
      <field2>40</field2>
   </structure>
</root>

mapped with field1 (context to root) -> structure gives me as result

<root>
   <structure>
      <field2>10</field2>
   </structure>
</root>

I would like to have:

<root>
   <structure>
      <field1>20</field1>
      <field2>30</field2>
   </structure>
</root>

Thx 4 ur help,

Udo

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Udo,

The above mapping you can use only when you change the occurence. If you dont want to change the occurence then you can map like this:

For structure map like this: seqno(change context to root) --> removecontext >exists> createif-->structure

For field1 : field1>removecontext>field2

For field2: use if then without else. For if: field1-->exists and for else: field2 and after if then put remove context.

Regards,

---Satish

udo_martens
Active Contributor
0 Kudos

Hi Satish,

>For structure map like this: seqno(change context to root) --> removecontext >exists> createif-->structure

What do you mean with seqno? I tried just this with field1 instead of seqno..

>For field1 : field1>removecontext>field2

field1 to field2??

>For field2: use if then without else. For if: field1-->exists and for else: field2 and after if then put remove context.

eh, function ifWithOutElse() has no else branch...

Regards,

Udo

Former Member
0 Kudos

Hi Udo,

My bet. I am using Seqno in my testing instead of field1. So it is a typo. You can use field1.

For target structure map like this: source field1 (change context to root) --> removecontext >exists> createif--> target structure

For target field1 : source field1>removecontext> target field1

For target field2: If source field1-->exists then field2 --> remove context --> target field2.

Hope this works. I mean not your sdn id, your contact id so that I can give screen shot of my testing.

Cheers,

---Satish

udo_martens
Active Contributor
0 Kudos

Hi Sathish,

your mapping looks very logical. It should work but it does not on my system. The output is like described, it gives me the output of the first structure instead of the second. May be i m temporary blind, should have a break

Do you thing there could be a bug with the release (7.1 / SP 06)?

I changed the profile, my address should now be visible.

Regards,

Udo

Former Member
0 Kudos

Udo,

I send the document. Please take a look.

Regards,

---Satish

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Udo,

You can do your mapping like this Udo:

I changed the occurence of your mapping to 0..unbouned in mapping.

For root in target: field1(change context to root in source) > removecontext>exists>creatif>root

For Strucurte in target: field1 > removecontext>exists-->creatif -->Strucurte

For field1 in target: fiedl1>removecontext>field1

For field2 in target: use if then. For if > field1>exists>removecontext and for else field2>removcontext and after if then put a removecontext --> field2.

I tested in my system and it worked but I tested only for this test case. Try for all.

Regards,

---Satish

udo_martens
Active Contributor
0 Kudos

Hi Satish,

thx for posting

I checked your solution, but i got the same result, may be i understood something wrong.

>I changed the occurence of your mapping to 0..unbouned in mapping.

I dont understand that. Are you talking about a multi mapping?

>For root in target: field1(change context to root in source) > removecontext>exists>creatif>root

The root is of course occurence 1, so i dont need to map it, right?

>For Strucurte in target: field1 > removecontext>exists-->creatif -->Strucurte

I tried to map the structure like you recommended. It should now give ONLY structures where the child field1 exists. This works, if the first structure has such a child, but not in my example. I get the wrong structure.

Do you think i need to use node functions as well for field1 or field2? Can they appear in a wrong structure?

Regards,

Udo

Former Member
0 Kudos

Udo,

My post 1 is if you can do multimapping.

My post2 is if you dont want to do multimapping.

I tested both the test cases in my system and they are working for me. Can you update your id in your business card.

Regards,

---Satish

udo_martens
Active Contributor
0 Kudos

Hi Satish,

>Can you update your id in your business card.

What are you missing? The user-ID is not changeable, but i assume you mean something else.

Regards,

Udo