cancel
Showing results for 
Search instead for 
Did you mean: 

Help still needed in Graphical mapping

Former Member
0 Kudos

Hi Guys

I have already posted a part of this qustion but I was to fast to close it , this is the other part of it

I have the source structure .

<M>

<regsegm>

<regnr>10</regnr>

<regnr>20</regnr>

<regnr>30</regnr>

</regsegm>

<regsegm>

<regnr>40</regnr>

<regnr>50</regnr>

<regnr>60</regnr>

</regsegm>

</M>

Target

<H>

<customsegm>

<custnr></custnr>

</customsegm>

</H>

I have to create one <customsegm> for each <regsegm> , this is easy to do , but for the custnr I have to map

the first occurence of regnr of each node <regsegm> to the custnr in the created <customsegm>

for instans here in this source structure we have to create 2 <customsegm> nodes .

as following

<H>

<customsegm>

<custnr>10</custnr>

</customsegm>

<customsegm>

<custnr>40</custnr>

</customsegm>

</H>

all the regnr after the first one should not be mapped , but I am always getting them .

Hope for your help which is badly needed .

BR

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can simple map as below:

regnr -> collapseContext -


>SplitByValue[each value]-->custnr

Regards

Pravesh

Former Member
0 Kudos

Hi

Problem solved by Pravesh suggestion

Thanks

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Use single line UDF:

Execution type:All values of a context, Input will be : a

result.addValue(a [ 0 ] );

regnr -> UDF -> custnr

Thanks

Amit

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

The mapping will be a little bit complicated, but the solution will be similar as was suggested in your last thread:

Here is the additional mapping


                                                  regnr(set context to M) -> collapseContext -> splitByValue:each value -> (1) useOneAsMany -> \                                                                                
regsegm -> (2,3) /           \
M -> index:1,1 -> sort:desc case insensitive -> collapseContext -> concat: -> splitByValue: each value -> (1) useOneAsMany -> (1) greater -> (1) ifThenElse -> splitByValue: each value -> custnr
                                                               M -> /                           regsegm -> (2,3) /   constant:1 -> (2) /        /
                                                                                regnr (no context manipulation) -> collapseContext -> /

Make sure M has no context changes, otherwise the mapping will not work.

Hope this helps,

Mark