cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping of same structure

Former Member
0 Kudos

Dear Experts,

I have querry regarding the mapping of source and target structure.The source and target structure are same.

The structure looks like this.

<Source>

+<Header>

<LineItem> 0:Unbounded

<Value> 1:1

<Text> 1:1

<LineItem>

Even if there is no entries in Value and Text field of tag <LineItem> , I have to show in the target.

-<Header>

-<LineItem>

-<Value/>

-<Text/>

-<LineItem>

-<Header>

Please help for the mapping of the Source Line Item and Target Line Item,

Regards

Alice Rebecca

Accepted Solutions (1)

Accepted Solutions (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

do one to one mapping and use map with default function ,it solves your req.

Former Member
0 Kudos

Hi Rajashekar,

Are you referring to Node Functions -> MapwithDefault.

Regards

Alice Rebecca

former_member184681
Active Contributor
0 Kudos

Yes, this is the one to use.

Former Member
0 Kudos

Hi Alice,

Yes , the mapwithDefault function belongs to Node function. Every field of the Source strcuture can be mapped to Target structure by mapwithDefault with empty values. Apart from this , the node of the source structure and target structure can also be mapped with this function. Hope it works.

Regards

RT

Answers (2)

Answers (2)

former_member184681
Active Contributor
0 Kudos

Hi Alice,

For Line Item, use straight mapping without any additional functions. For both: Value and Text, use source -> mapWithDefault -> target, and set the default value in mapWithDefault to empty (just erase the value). Thus you will achieve the required functionality.

Hope you'll find this useful,

Greg

Former Member
0 Kudos

Why not just use 'Duplicate Subtree' against <LineItem> in the target structure, so you have

LineItem

LineItem[1]

Map the first one as the source message, and only create the second one if no <LineItem> exists in the source.