cancel
Showing results for 
Search instead for 
Did you mean: 

Advanced mapping requirement!

Former Member
0 Kudos

Hi Crew,

I need the mapping logic to acheive this target structure from the source structure.

Source Structure:

<Pen>

<colour>Red</colour>

<company>Parker</company>

<type>Refill</type>

</Pen>

Target Structure:

<Pen>

<character>

<no>1</no>

<name>colour</name>

<value>Red</value>

</character>

<character>

<no>2</no>

<name>company</name>

<value>Parker</value>

</character>

<character>

<no>3</no>

<name>type</name>

<value>Refill</value>

</character>

</Pen>

Kindly help!

Thanks in advance

karthik kaveriselvan

Accepted Solutions (0)

Answers (4)

Answers (4)

justin_santhanam
Active Contributor
0 Kudos

Karthik,

First let me confirm your structure.

Source

<Pen> 0..Unbounded

<color/>

<company/>

<type/>

</Pen>

Target

<Pen>0..Unbounded

<character>0..Unbounded

<no/>

<name/>

<value/>

</character>

</Pen>

If you think i'm correct, then proceed with below logic.

In Mapping editor Right click on <character> and click duplicate sub-tree three times.

Now follow the logic.

Pen -


>Pen.

character(1 occurrence)

Constant[1] -


> no

Constant[colour]----->name

colour -


> value

Character(2 occurrence)

Constant[2] -


>no

Constant[Company]----name

company---->value.

Character(3 occurrence)

Constant[3]---->no

Constant[Type]---->name

type--->value.

Hope it helps!!!!

Best regards,

raj.

prabhu_s2
Active Contributor
0 Kudos

set the context of the subnodes to PEN.

<b>Generate character for every entiries in Source</b>

pen ---> splitbyvalue(valuechanged) -> No

<b>Generate numbers</b>

pen ---> splitbyvalue(Eachvalue) ->INDEX -> No

for the rest u might need to use a udf to read the source node name. let me check if there is a std function for this

prabhu_s2
Active Contributor
0 Kudos

maybe this shud be easy using java mapping if std funtions are not avaiable to read the soruce field name

Former Member
0 Kudos

Hi Karthik,

According to your query, i am taking the following asumption and writtten logic. if my asumpation are true then you can use the following logic

1. Pen has 3 feature always [color,company,refill]

Logic. Create the following 3 UDF's

1 UDF

Return the 3 sequence numbers and use Split by value after the UDF. Mapped to the No

2. UDF

Return the 3 hard coded values Color, Company, Type and use the Split by value after the UDF. Mapped to the Name

3. UDF

Return the 3 values Color, Company, Type and combined and use the Split by value after the UDF. Mapped to the value

and Map the First UDF also with Character.

Pen to Pen.

Then your problem will solve

Best Regads,

Vijay

Former Member
0 Kudos

Hi karthik

/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions

simple java function:

advanced java function:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e55f95...

http://help.sap.com/saphelp_nw04/helpdata/en/79/2835b7848c458bb42cf8de0bcc1ace/frameset.htm

hope it will help u ....

Pls reward if useful