cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Query

Former Member
0 Kudos

Hi All,

We have an IDoc to File scenario.

For one particular IDoc segment we need to do the following.

Considering the segment is as below.

Segment

     Field1

     Field2

     Field3

     Field4

This segments occurs multiple times in all IDocs. Field1,Field2 and Field4 are mapped directly to File Fields in target.

Now if Field3 is 0 in a particular segment then we will not be populating the values of Field1,Field2 and Field4 in corresponding target fields. We will only populate values of Field1,Field2 and Field4 in target only for the segment where Field3 is not equals 0.

However, if all the segments contains Field3 as 0 then we need to populate only the values of Field1, Field2 and Field4 from the values of first segment..

i.e. say

Segment[1]

     Field1 1

     Field2 2 

     Field3 0

     Field4 4

Segment[2]

     Field1 2

     Field2 4

     Field3 3

     Field4 8

Segment[3]

     Field1 3

     Field2 6

     Field3 1

     Field4 2

In this scenario we need to populate the target fields with values from Segment[2] and Segment[3].

However if it looks like

Segment[1]

     Field1 1

     Field2 2 

     Field3 0

     Field4 4

Segment[2]

     Field1 2

     Field2 4

     Field3 0

     Field4 8

Segment[3]

     Field1 3

     Field2 6

     Field3 0

     Field4 2

i.e all the segments have Field3 as 0 then we need to populate only values from Segment[1].

While implementing first scenario is simple to me, I am not able to figure out how to do it for all 0s and also to combine them together.

Thanks,

Shaibayan

Accepted Solutions (0)

Answers (1)

Answers (1)

Ryan-Crosby
Active Contributor
0 Kudos

Hi Shaibayan,

What are the possible values for field3?  If it is only the list of all real non-negative integers then you can use a combination of sort ascending and collapse context on field3 as your if condition maybe to determine how the other fields should be populated.

Regards,

Ryan Crosby

Former Member
0 Kudos

Hi Ryan,

All possible values are either 0 or non-zero. For non-zeros I can pull the data. However for all 0s I am not sure how to pick only the first segment values.

Thanks.

former_member190293
Active Contributor
0 Kudos

Hi Shaibayan!

You could use one mapping sequense for segments matching your condition. Then duplicate target segment and create it only if all values in source segments are equal to 0. You can use Sum function for values of context to check if non-zero value exists for context.

Thus, either segments with non-zero value will be mapped to target or one segment will be created if all values are equal to 0.

Regards, Evgeniy.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

Create two segments of the target field, one for the non-zero and one for the zero. This can be done by right-clicking on the target node and selecting duplicate subtree.

Once the segment has been duplicated. Here's an example mapping for Segment and Field1 (non-zero)

Field2 and Field4 (non-zero)

Here's the mapping for Segment[1] (zero)

Field1, Field2 and Field4 (zero)

Test1 (non-zero)

Test2 (zero)

Regards,

Mark