cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional Mapping

Former Member
0 Kudos

hi,

Source Structure:

<root>

<a>

<a1>test1</a2>

<a2>test2</a2>

<a3>test3</a3>

</a>

<b>

<b1>beta1</b1>

<b2>beta2</b2>

</b>

<c>

<c1>ctest1</c1>

</c>

</root>

based on a condition i do not want to display the entire <a> tag

Target Structure:

<root>

<b>

<b1>beta1</b1>

<b2>beta2</b2>

</b>

<c>

<c1>ctest1</c1>

</c>

</root>

How can achieve this?

Thanks,

Tirumal

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi,

check the condition for existance of the element(<a>) and use createif function for creating the element(<a>) in target structure.This might solve the issue

Thanks and Regards

kausik

Former Member
0 Kudos

Hi,

use the If function.

If the condition is satisfied, then map source <a> to target.

This will create a <a> tag in the target only if the condition is true. If the condition is not satified, the target <a> would not be created.

Regards,

Smitha.

former_member187339
Active Contributor
0 Kudos

Hi,

Whats the minimum occurence of <a> ??? Is it 0.

Then give your condition on that node.

Regards

Suraj

Former Member
0 Kudos

Suraj -

Yes the minimum occurrence is 0. Occurrence is 0..1.

I will try your solution and will get back to you.

Thanks,

Tirumal

Former Member
0 Kudos

Tirumal,

You can use standard function createIf for this purpose.

praveen

former_member206604
Active Contributor
0 Kudos

Hi,

I think you would have mapped this way

Source                Target
<root>     -->         <root>
 <a>       -->          <a>
  <a1>     -->           <a1>
.
.
<b>        -->         <b>
.
.

so on

Now when you do a mapping from <a>--><a> add your condition

<a> --> Condition --> <a>

Tell me if you need more help