cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping issue, "many to many" mapping

Former Member
0 Kudos

Hi specialists!

I have to map this structure:

source

-


segment_1 (1...n)

key_1

aaa

bbb

-


segment_2 (1...n)

key_2

ccc

ddd

-


Target:

-


segment_2

ccc

ddd

-


The condition is segment_1=>key1 = segment_2=>key2

The problem is that I need to check each segment_1 with each segment_2.

Is it possible using standard mapping functions?

Accepted Solutions (1)

Accepted Solutions (1)

tom_wall
Explorer
0 Kudos

Dani_K,

This can be done with standard mapping if your source.segment_1.key_1 is unique. If it is not, you could end up with a many to many mapping which would be difficult no matter how you map.

Try this:

For segment_2

source.segment_1.key_1 (right click, context, source) ---> sort --->

source.segment_2.key_2 (right click, context, source) ---> sort --->

equalsS ---> ifWithoutElse --->

source.segment_2 (then)

removeContexts (after the If Then)---> target.segment_2

For ccc

source.segment_1.key_1 (right click, context, source) ---> sort --->

source.segment_2.key_2 (right click, context, source) ---> sort --->

equalsS ---> ifWithoutElse --->

source.segment_1.ccc (right click, context, source) (then)

removeContexts (after the If Then)---> SplitByValue(Each Value) ---> target.segment_2.ccc

For ddd

source.segment_1.key_1 (right click, context, source) ---> sort --->

source.segment_2.key_2 (right click, context, source) ---> sort --->

equalsS ---> ifWithoutElse --->

source.segment_1.ddd (right click, context, source) (then)

removeContexts (after the If Then)---> SplitByValue(Each Value) ---> target.segment_2.ddd

Ideally, the segment_1.Key_1 and segment_2.key_2 are sorted before you process the message. If so, remove the sort above.

Answers (2)

Answers (2)

Former Member
0 Kudos

Solved by UDF. Thanks for answers.

nabendu_sen
Active Contributor
0 Kudos

If the no. segment_1 (1...n) is not equal to segment_2 (1...n), mapping will fail. You can use 'mapWithDefault' before each comparison.