cancel
Showing results for 
Search instead for 
Did you mean: 

File to Idoc - Generate one segment where sourcfields have identical values

Former Member
0 Kudos

Hello Team,

This is a Flat File to Idoc scenario where one idoc is generated at the target.

As i have mapped the Record(1..unbounded) with the E1MBXYI (1..9999), one record in the file would create one E1MBXYI- segment in the Idoc. So if the source has four records then this would create an idoc with four E1MBXYI-segments. The requirement is, it has to generate only 1 segment for the input records(Order,Item and Date) if they have identical values.

eg., 1234,66,01032009 (Order,Item,Date)

1234,67,01032009

1234,68,01032009

1234,69,01032009 - this would generate four E1MBXY1 segments in the target each for item value 66,67,68 & 69 as it has no identical item values.

eg., 1234,66,01032009

1234,67,01032009

1234,66,01032009

1234,68,01032009 - this would generate three E1MBXY1 segments each for item value 66,67 & 68 in the target.The 2 identical item values for item 66 creates one segment.

How could i achieve this in the mapping, Should i go for an UDF or could it be achieved using standard functions?

Appreciate your replies....

Thanks,

Rag

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Ragavendra,

lets say when your flat file pick by PI and converts in to xml file

and Message Structure as follows

<List> 1-1

<ParentNode> 0-unbounded

<Child1> 0-1

<Child2> 0-1

then follow the below logic

<Child1>-->RemoveContext Node function>Split by Value(set the property as on value change)->CollapseContext---<ParentNode>

Secondly: introduce split by value(for each value ) after collapse context for child1 and child2. as shown below.

<Child1>-->RemoveContext Node function>Split by Value(set the property as on value change)->CollapseContext>Split by value(for each value)----</Child1>

<Child2>-->RemoveContext Node function>Split by Value(set the property as on value change)->CollapseContext>Split by value(for each value)----</Child2>

Regards,

Pradeep A.

Former Member
0 Kudos

I Assume you have fields Order ,Item, Date under Record in the Source.And similar fields under the segment in the idoc.

Don't think your requirement could be achieved using standard functions.

UDf will have to be written for each field.

Eg to get the desired number of segments;

You can raise the context of item field to the topmost level.

Pass it to the udf.Then in the udf keep a count on the number of distinct values of items.

And those many times(i.e in a loop) you can write result.addValue(""); which will generate those many segments.

such udf's will have to be written for other fields as well.

Former Member
0 Kudos

Hi Raghavendra,

U can achieve this by simple graphical mapping.

U can do ir using following functions,

If

equlas

and

context changes.

eg.

order order

order

item equalsS then

and if

date

order equalsS else

order(context change) order

repeat the same for other fields also,

item and date....

If any doubt pl post the problem....

I hope this will be helping u...