Skip to Content
Author's profile photo Former Member

Create multiple files from single file based on data.

Create multiple files from single file based on data.

While working in one scenario, I got a requirement where the source data consists of multiple records for multiple PARTNERS. At the target side, we have to generate multiple files, one for each partner.

I feel many of us would have faced similar requirement. In this document, I am sharing the way I implemented it.

The source data looks similar to the one shown below.

Source File.

Employee; Subject: Marks

EMP1;MATHS;23

EMP2;ENGLISH;45

EMP1;PHISICS;33

EMP1;ENGLISH;39

EMP2;PHISICS;37

There could be N number of EMPloyees

The target should look like this.

Target File: 1

Employee; Subject: Marks

EMP1;MATHS;23

EMP1;PHISICS;33

EMP1;ENGLISH;39

Target File 2

Employee; Subject: Marks

EMP2;ENGLISH;45

EMP2;PHISICS;37

One way to do this is, for N different EMPLOYEES, create N nodes at the target side in multimapping. This approach is lengthy, and could not be used if we don’t know exact number of Employees. Here, I will be using one Message at the target side, to create multiple files based on Employees.

Sender/ receiver Data type.

Sender and receiver structure will be same.

/wp-content/uploads/2013/09/file1_277361.jpg

In Message Mapping, we have to change the occurrence of Target message to 1 to Unbounded. This can be achieved from Signature tab in message mapping.

/wp-content/uploads/2013/09/file2_277362.jpg

The sender data will be as shown in screenshot below.

Sender Data

/wp-content/uploads/2013/09/file3_277363.jpg

Expected output data:

file 4.jpg

Here, every “FetchData_1” node will generate separate file at the target side.

Mapping for “FetchData_1” node.

/wp-content/uploads/2013/09/file4_277365.jpg

EMPName is raised to context of FetchData_1. Similar mapping will be done for Records.

For other items eg: Subject  field below mapping needs to be done.

/wp-content/uploads/2013/09/file5_277366.jpg

Context for EMPName and Subject is raised to FetchData_1 node.

Here EMPName is used for mapping all other fields because we have to create different files based on EMPNumber.

Please share your views on this. Please let me know if there is any possibility of improvement in this design.

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Gavaksh,

      Good document 🙂