cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping issue

Former Member
0 Kudos

Hi,

I have an issue where I have 2 segments in the source but I want to only create 1 Idoc depending on the input.

The rule is depending on two fields (X & Y) in the input file. If the fields X & Y is the same in both segments then I only want to create one Idoc where I take the values from the first segment. But if the field X is the same in both segments but the field Y is different then I want to create two Idocs where I have the different values in the field Y.

Scenario 1

Source

Item

Y- 1

X- 2

Item

Y- 1

X- 2

Target

Idoc

Item

Y-1

X-2

Scenario 2

Source

Item

Y- 1

X- 2

Item

Y- 5

X- 2

Target

Idoc

Item

Y- 1

X- 2

Idoc

Item

Y- 5

X- 2

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

What if Y value is same in both the segments and X differs?

try this


Y---->removeContext---->sort-->SpliByValue(ValueChange)------>CollapseContext---->Idoc
Y---->removeContext---->sort-->SpliByValue(ValueChange)------>CollapseContext---->Item
x--->X
Y--->Y

Former Member
0 Kudos

Hi,

You can acheive this by using UDF(User Defined Functions) by passing both fields X&Y of both the segments as input to the UDF and inside UDF you can check the conditions which you have specified in your post in IF ELSE statement i.e if values X & Y are same in both the segments then only create target IDoc node only once using return statement else create target node twice with the same return function.

Your graphical mapping with UDF would look something like this

X1 -


>

Y1 -


> CreateIDoc ---> IDoc

X2 -


>

Y2 -


>

Where X1,Y1 are the fileds of first segment and X2,Y2 are the fields of second segment.

Inside UDF you can write following code:

 
IF (X1 == X2 && Y1==Y2)
{
return X1;
}
ELSE IF(X1 == X2 && Y1 != Y2)
{
return Y1;
return Y2;
}

Regards,

Amit

Former Member
0 Kudos

Hi Amit,

Yes you are correct about that but the issue is that I can't differentiate the two segments since they both have the same name. therefore I can't call them X1 and X2. both are X1 that have been duplicated in the structure.

do you know what I mean?

that is my problem that I can't seperate the two segments otherwise I could only compare them in the graphical mapping.

jyothi_anagani
Active Contributor
0 Kudos

Hi Sonny,

Do Like this...

Y-->removeContext>SpliByValue(ValueChange)-->CollapseContext-->Idoc

Y-->removeContext>SpliByValue(ValueChange)-->CollapsContext-->Item

Y-->removeContext>SpliByValue(ValueChange)---->Y

X-->removeContext>SpliByValue(ValueChange)---->X

Thanks.