cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping problem

Former Member
0 Kudos

Hi all,

I have a issue in mapping.

My input is like:

<row>

<a>..</a>

<record>

<item>..</item>

</record>

<record>

<item>..</item>

</record>

<record>

<item>..</item>

</record>

<record>

<item>..</item>

</record>

</row>

...

My output should be like

<row>

<a>..</a>

<item1>..</item1> -


> first item of the record

<item2>..</item2> -


> second item of the record

<item3>..</item3> -


> third item of the record

<item4>..</item4> -


> fourth item of the record

</row>

...

Which functions do I have to use?

Accepted Solutions (1)

Accepted Solutions (1)

former_member200962
Active Contributor
0 Kudos

assuming that item1/2/3/4 are names of different target nodes.....you can make use of the Index function

Source --> Index -->

--> equalS --> If (item --> Then) --> target Item1/2/3/4

Constant (1/2/3/4)

Regards,

Abhishek.

Former Member
0 Kudos

I tried it, but every row in the input increases the index by 1.

so for the first row, the index is 1 for every item???

Former Member
0 Kudos

Set initial value =0 , increment = 1 in index.

For mapping item1(target field), compare the output of index with constant 0 and map item(source field).

Similarly for item2 , item 3 etc compare the output of index with constant 1, 2 etc respectively and map item.

Regards,

Vishal

former_member200962
Active Contributor
0 Kudos

Source:

<?xml version="1.0" encoding="UTF-8"?>

<testsource>

<row>

<record>

<item>123</item>

</record>

<record>

<item>456</item>

</record>

<record>

<item>789</item>

</record>

</row>

</testsource>

Target:

<?xml version="1.0" encoding="UTF-8"?>

<testtarget>

<row>

<item1>123</item1>

<item2>456</item2>

<item3>789</item3>

</row>

</testtarget>

Logic:

item --> index (1,1) -->
                    --> equalS --> If (item --> Then) --> item1
Constant(1)-->

context of both source item was raised to row level. keep index setting same for all....increase value of Constant as per the node...for item2 Constant will be 2 and so on.

Regards,

Abhishek.

Former Member
0 Kudos

Thats it! thank you very much.

Answers (1)

Answers (1)

Shabarish_Nair
Active Contributor
0 Kudos

use splitbyvalue to help you here