cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping flat file to Idoc

Former Member
0 Kudos

Hi all,

i have to create an Idoc from a flat file. My structure is described below:

DOC_NUMBERITEM NUMBERCUSTOMER_NUMBERVALUE
0000000100112345678905
000000010025555555555
000000010036666666666
000000020017777777777
0000000200212345678903
000000020033333333333

I created 2 idocs at doc_number value changed, with 3 items each.

idoc1

     |_header ( 00000001 )

          |_Items ( 001 )

          |_Items ( 002 )

          |_Items ( 003 )

idoc2

     |_header ( 00000002 )

          |_Items ( 001 )

          |_Items ( 002 )

          |_Items ( 003 )

I have to create also a new segment when the customer value is equal to "1234567890".  I tried to use the Node function: "CreateIf", but the result is :

idoc1

     |_header ( 00000001 )

          |_Items ( 001 )

          |_Items ( 002 )

          |_Items ( 003 )

          |_Customer( 1234567890 )

          |_Customer( 1234567890 )

idoc2

     |_header ( 00000002 )

          |_Items ( 001 )

          |_Items ( 002 )

          |_Items ( 003 )

Any suggestions ?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184681
Active Contributor
0 Kudos

Hi,

Most probably you need a context change for the target node Customer. Use splitByValue(Each Value) function to add the required context change.

Regards,

Greg

Former Member
0 Kudos

Hi Greg,

thank u for your replay.

I'm using the below mapping:

CUSTOMER_NUMBER --

                                     |___ "EqualS"-- > "CreateIf" --> "CollapseContexts"--> SEGMENT

                                     |

constant (1234567890 ) --

What should I use to connect the two functions ( createIf and  splitByValue(Each Value) ) ?

thank you in advance.

Regards,

Daniele.

former_member184681
Active Contributor
0 Kudos

Dear Daniele,

In the mapping you mentioned, simply delete the CollapseContexts function. This will help you get the expected partner segments created properly (in correct contexts), and will let you use simple 1:1 mappings with no further conditions for Customer node's subfields.

Regards,

Greg

Former Member
0 Kudos

Hi Greg,

I deleted the CollapseContexts function, but as result, no segment for customer_number was created. Below the queue content for the entries:

DOC_NUMBERITEM NUMBERCUSTOMER_NUMBERVALUE
00000000010016666666666
00000000010025555555555
000000000100312345678905
00000000020017777777777
00000000020023333333333
000000000200312345678903

SUPPRESS
SUPPRESS
SUPPRESS
SUPPRESS
SUPPRESS
[]
[]
SUPPRESS
SUPPRESS
SUPPRESS
SUPPRESS
[]
[]

Thank you very much for your support.

best regards,

Daniele

former_member184681
Active Contributor
0 Kudos

There is one more thing I need to know: this customer_number in target IDoc - is it a field or a segment?

Regards,

Greg

Former Member
0 Kudos

When the customer number is equal to 1234567890, I have to create a segment where I add the values of fields  "customer_number" and "value".

idoc1

     |_<header>

               |_ doc_number( 00000001 )

          |_<Items>

               |_item_number( 001 )

           |_<Items> 

               |_item_number( 002 )

           |_<Items> 

               |_item_number( 003 )

           |_<customer> 

                |_customer_number ( 1234567890 )

                I_value ( 5 )

idoc2

     |_<header>

               |_ doc_number( 00000002 )

          |_<Items>

               |_item_number( 001 )

           |_<Items> 

               |_item_number( 002 )

           |_<Items> 

               |_item_number( 003 )

           |_<customer> 

                |_customer_number ( 1234567890 )

                I_value ( 3 )

Best regards,

Daniele.

former_member184681
Active Contributor
0 Kudos

Ok, now it sounds clear. Try with the following:

customer_number -> equalsS( constant(1234567890) ) -> createIf -> customer(segment)

customer_number -> customer_number (field)

value -> value

Make sure there are no modifications to the contexts of the source fields - the default contexts should work fine.

Regards,

Greg