cancel
Showing results for 
Search instead for 
Did you mean: 

Context mapping problem

Former Member
0 Kudos

Hello Experts,

Is it possible to do such a graphical mapping:

source:

<item>

<indicator>1</indicator>

<data>

<value>a</value>

</data>

</item>

<item>

<indicator>2</indicator>

<data>

<value>b</value>

</data>

</item>

<item>

<indicator>1</indicator>

<data>

<value>c</value>

</data>

<data>

<value>d</value>

</data>

</item>

<item>

<indicator>1</indicator>

</item>

result:

<data>

<value>a</value>

</data>

<data>

<value>c</value>

</data>

<data>

<value>d</value>

</data>

The data elements should be taken from items with indicator equals to 1. The problem is, that each item can have 0..unbounded data elements. And that is why, for example the 5th data doen't always correspond to 5th indicator.

So how to do this mapping?

Thanks in advance for your help.

Accepted Solutions (0)

Answers (4)

Answers (4)

Jitendra_Jeswan
Contributor
0 Kudos

Try eith this Graphical mapping Solution and let me know if u face any issue.. Hopefully this is it.

1) Indicator & constant ("1")----> equals(text) ---> creatif(node function) ---> Data (target)

2) value (source)----> value (target)

Notes:

a) change the context of indicator to Item's Parent

b) EqualS is function from Text functions. First arg is "indicator" and 2nd is Constant with value =1

No need to use UDF for this.

Regard.s

JEet.

Former Member
0 Kudos

Hello Jeet,

Your solution will not work for the case when there is an item with indicator equal to 1, but with no data elemnts. All values of datas after the described item will be shifted in result..

Former Member
0 Kudos

Hello,

i think your requirement is still not clear.

Is your example the way you would like to have it,

because the value 'c' is on second position (in result) but comes from the third indicator (in source).

Please describe exactly what do you want to have.

Do you want maybe something like this:

<data>

<value>a</value>

</data>

<data>

</data>

<data>

<value>c</value>

<value>d</value>

</data>

<data>

</data>

Regards

Patrick

Former Member
0 Kudos

Hello Patrick,

I need the output exaptly that I have described in first message. No empy data elements and no data element with multiple values in the output.

Former Member
0 Kudos

Hello,

thats good to know.

It's possible to make a mapping like you described in your first message,

but then you have this problem:

> And that is why, for example the 5th data doen't always correspond to 5th indicator

To solve this problem i guess you have to change your target structure, but you have to say how a solution should look like and then it's possible to find a mapping for this solution.

Regards

Patrick

Former Member
0 Kudos

Hi,

This is Possible by writing a Advance user defined .Pass the Indicator as in input and check if it is equal to 1 then put as result.addValue of data else result.addsuppresslist

Former Member
0 Kudos

Hello Ramachandra,

Thanks for you answer. I have created an Advanced UDF, which manages the context changes and suppresses depending on inbound indicator and data queues. Now the mapping working fine.

Thanks, very helpfull answer. Points awarded

Former Member
0 Kudos

Hi Artsiom,

If indicator = 1, then map (source) item -> data -> value to (result) item -> data -> value, with the context of 'data' and 'value' set to 'item' level.

Thanks,

Varun

Former Member
0 Kudos

Hello Varun, Aashish

thanks for your responses, but your solutions will not work, because as I already mentioned there can be a couple of datas in one item, but the IF element will compare them by the sequance they are appear in message (like 1st with 1st, 2nd with 2nd .... etc), but, for example, the 5th indicator not always corresponds to the 5th data (if in previous items there was number a datas not equal to 1).

aashish_sinha
Active Contributor
0 Kudos

Hi,

yes it is quite possible using graphical as well as Java mapping.

Graphical mapping :

Use If - else - if to check the condition and map it to the target location.

In Java Mapping :

write an UDF and do the conditional mapping there as you do it in Java. In this UDF check out the <indicator>1</indicator> value, if it is one then it will go to target.

Regards

Aashish Sinha

PS : reward points if helpful