Skip to Content
author's profile photo Former Member
Former Member

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

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 04, 2009 at 09:34 AM

    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...

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 04, 2009 at 09:35 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 04, 2009 at 05:02 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.