cancel
Showing results for 
Search instead for 
Did you mean: 

Context Mapping, flat file to deeply nested XML Structure

pranay_aitha2
Participant
0 Kudos

Hello,

I am trying to use Graphical mapping where my Source structure is

Records

             Record

             Batch_Header

             Detail

             Batch_Control_record

             Record_trailer

I want to map Detail section into a nested XML Structure(items) which is.

Main

     Batch

          Details

               Items

      Batch_trailer

file_trailer  

I am trying to do this using the graphical mapping, any suggestions ?

Accepted Solutions (1)

Accepted Solutions (1)

manoj_khavatkopp
Active Contributor
0 Kudos

Pranay,

Did u try mapping  source (detail) --> target (item) fields and constant([])-->target (details-node) field map some empty constant.

Br,

Manoj

pranay_aitha2
Participant
0 Kudos

Hey Manoj,

Yeah I tried that, didn't help

for example I have

batch1

     detail1

     detail2

endofbatch1

batch2

     detail3

     detail4

endofbatch2

I am getting

batch1

  detail  

     item1

     item2

     item3

     item4

endofbatch1

batch2

     detail

endofbatch2    

manoj_khavatkopp
Active Contributor
0 Kudos

Pranay,

Try this :

Source(detail)-->target(details)

Source(details)-->Split by value(each value)-->target(item)

Br,

Manoj

pranay_aitha2
Participant
0 Kudos

Hi Manoj,

Its giving the same response as the above, all the Item elements are created under just one Batch.

Regards,

Pranay

manoj_khavatkopp
Active Contributor
0 Kudos

It would be helpful if you put screenshot of complete sender and receiver RFC structure

pranay_aitha2
Participant
0 Kudos

Please find the screenshot of the structure.

RaghuVamseedhar
Active Contributor
0 Kudos

Pranay,

It is not possible to achieve required target XML using standard node functions.

UDF or Java Mapping is required.

Solution 1:

Solution 2:

pranay_aitha2
Participant
0 Kudos

Hi Raghu,

My Case is bit different from Solution one, I have individual fields under Details in Source Structure. I am trying to map these fields to the individual fields of Item, under Details on target Structure.

Regards,

Pranay

former_member182412
Active Contributor
0 Kudos

Hi Pranay,

Check my blog below.

Can you put source xml and expected target xml so that we can help you.

Regards,

Praveen.

pranay_aitha2
Participant
0 Kudos

Hi Praveen,

I have similar scenario as you mentioned in the blog and tried to implement the solution, It still gives me the same output structure(All the Details in the first Section )

former_member182412
Active Contributor
0 Kudos

Hi Pranay,

In the blog i am getting the data from flat file, Using FCC i am getting the Header and detail nodes are coming in separate context but in your case it is coming under same context that is why it is not working.

Are you also reading the data from flat file using sender CC then you need to apply the same FCC which mentioned in the blog, if not let me know what is the source.

Regards,

Praveen.

pranay_aitha2
Participant
0 Kudos

Hi Praveen,

Please find the FCC parameters below with file sample

Records.fieldFixedLengths1,50,32,30,26,461
Records.fieldNamesRecord_Type,Main_Partner_key,Partner_Name,External_Partner_ID,DT,Filler
Records.keyFieldValue0
Records.lastFieldsOptionalYES
Batch_Header.fieldFixedLengths1,50,32,30,487
Batch_Header.fieldNamesRecord_Type,Partner_key,Partner_name,External_Partner_id,Filler
Batch_Header.keyFieldValue1
Batch_Header.lastFieldsOptionalYES
Detail.fieldFixedLengths1,32,1,32,15,100,15,8,32,9,22,2,2,3,25,50,32,30,32,2,2,50,2,26,25,16,34
Detail.fieldNamesRecord_Type,First_Name,Middle_Name,Last_Name,SSN,email,Amount,Payment_Date,Customer_ACC_Number,Routing_No,Acc_number,Funding_Account_type,Funding_Account_subtype,T_COde,Confirmation_Number,Partner_key,Partner_Name,External_ID,Customer_ID,Channel_type,transaction_type,Statement,Payment_type,Entry_Date,External_transaction_ID,Agent,Filler
Detail.keyFieldValue2
Detail.lastFieldsOptionalYES
Batch_Control_Record.fieldFixedLengths1,50,32,30,10,15,10,15,437
Batch_Control_Record.fieldNamesRecord_type,Partner_Key,Partner_Name,External_Partner_ID,Num_Credit_Records,ValueOf_Credit_Records,Num_Debit_Records,ValueOf_Debit_Records,Filler
Batch_Control_Record.keyFieldValue8
Batch_Control_Record.lastFieldsOptionalYES
Record_trailer.fieldFixedLengths1,5,10,15,10,15,544
Record_trailer.fieldNamesRecord_type,num_of_batch,Num_of_credit,Val_of_credit,Num_of_debit,Val_of_debit,Filler
Record_trailer.keyFieldValue9
Record_trailer.lastFieldsOptionalYES

former_member182412
Active Contributor
0 Kudos

Hi Pranay,

Change the record sequence to 'Ascending' as per the blog and test and let me know.

Regards,

Praveen.

pranay_aitha2
Participant
0 Kudos

Hi Praveen,

I get the  Record_Trailer only at the end of the file , so if i change it to Ascending. its going to error in the Sender Channel expecting this after the first record.

Regards,

Pranay

former_member182412
Active Contributor
0 Kudos

Hi Pranay,

As per the blog set the Recordset Structure like below. And add keyFieldName for all the segments(Records.keyFieldName.. etc).

Input XML after the FCC.

The remaining you can follow the blog and test the mapping and let me know.

Regards,

Praveen.

pranay_aitha2
Participant
0 Kudos

Hi Praveen,

If we change the Channel settings to above, we can have multiple Batch_header Segments inside an Record right ?

regards,

Pranay

former_member182412
Active Contributor
0 Kudos

Hi Pranay,

As i shown the screen shot above only one Batch_Header inside the Records.

Regards,

Praveen.

pranay_aitha2
Participant
0 Kudos

Hi Praveen,

My input file can be the belwo too, I can have two or more batch_headers.

former_member182412
Active Contributor
0 Kudos

Hi Pranay,

I took exact same example.

Mapping:

Regards,

Praveen.

pranay_aitha2
Participant
0 Kudos

Hey Praveen,

Sorry I posted the wrong screenshot of the File. I am missing an Batch Trailer in the last posted file screenshot.

Attached is the new one.

former_member182412
Active Contributor
0 Kudos

Hi Pranay,

I have tested both files it will work for both files.

Regards,

Praveen.

pranay_aitha2
Participant
0 Kudos

Thank You Praveen,

Its working Finally!!!

Answers (0)