cancel
Showing results for 
Search instead for 
Did you mean: 

Requirement to create multiple files from 1 xml

Former Member
0 Kudos

Hi All,

I have below requirement and need your suggestion to how to achieve it.

We are on PI 7.1 version

My scenario is Web Service to File scenario.

When the request will come to PI, according to one of the parameter i have to decide that from 1 request i will have to create either 2 or 3 or 5 files with different names in different folders.

Please help me achieve this requirement.

Thanks,

Hetal

Accepted Solutions (1)

Accepted Solutions (1)

former_member184720
Active Contributor
0 Kudos

I believe this can be done in one flow if you can make use of variable substitution.

If you don't have any such additional fields then another approach to look for -

engswee
Active Contributor
0 Kudos

Yes, indeed single flow is possible (missed that out!) There are prerequisites though - target structure needs to contain the fields that have the values for the dynamic filename and folder, and target format must be in XML.

Former Member
0 Kudos

Hi Hareesh,

Thanks for the response. Can you please let me know more about variable substitution scenario?

How can I do that?

Thanks,

Hetal

Answers (1)

Answers (1)

engswee
Active Contributor
0 Kudos

Hi Hetal

You will have to do a multi-mapping to generate the multiple target messages. Then you use the following approach to realise the different filenames and folders via dynamic configuration.

Rgds

Eng Swee

Former Member
0 Kudos

Hi Eng Swee,

Thanks for the response. In my scenario, the target files are going to have exactly same information its just the matter of creating multiple files according to the document type

eg : if Doc type = ABC create 3 receiver files with different names and in different folders

       if Doc type = XYZ then create 5 receiver files with different names and in different folders

       if Doc type = MNP then create 2 receiver files with different names and in different folders.

Do I still have to do the multimapping? if so how many target messages do i have to create?

Also how many file receiver channels do i need to create?

Please let me know.

Thanks,

Hetal

former_member184720
Active Contributor
0 Kudos

You can just modify the below custom adapter module and use it.

Logic can be something like this -

if  Doc type = ABC -> then set the dynamic file-name in the mapping to some "ABC.txt"

if  Doc type = XYZ-> then set the dynamic file-name in the mapping to some "XYZ.txt"

if  Doc type = MNP-> then set the dynamic file-name in the mapping to some "MNP.txt"


Then in the module you can add the logic to create as many copies as you want based on the filename.


If the file name is ABC -> then copy it to three locations(you can define three properties as well to get the directory&file name information)


This way no multimapping/multiple channels..



engswee
Active Contributor
0 Kudos

Hi Hetal

As you can see there are various approaches to achieving this type of requirement. However, I feel there are still insufficient details to determine which approach is suitable/feasible in your case.

Are you able to share the following details:

1) The source structure

2) The target structure(s) - are there more than one or just 1?

3) Target file format - CSV, fixed length, XML, etc?

4) The logic to determine the filename and destination location. Please provide which source field and value, and how that affects the filename and destination.

Rgds

Eng Swee

Former Member
0 Kudos

Hi Eng Swee,

We are still in very early stage of the requirements. I have got this requirement in which I will have to confirm if this is achivable in PI or not.

Please see my comments below for your question.

Are you able to share the following details:

1) The source structure

HS - I do not have the source structure as of now. So won't be able to share it.

2) The target structure(s) - are there more than one or just 1?

HS - As per the requirement there will be only 1 target structure.

3) Target file format - CSV, fixed length, XML, etc?

HS - Yet to determine.

4) The logic to determine the filename and destination location. Please provide which source field and value, and how that affects the filename and destination.

HS : Do not have this information as of not.

I will try to share this information, once I get the confirmed requirements.

Thanks,

Hetal

engswee
Active Contributor
0 Kudos

Hi Hetal

As it is early in the requirement gathering stage and you do not have all the details, it is hard to suggest which option to go for. The actual details for all the points I listed above will influence which option is feasible and which is not.

However, as you can see from the input from the rest here that there are various approaches to handling this type of requirement. As such, I'm quite confident that once your requirement is finalized you would have the clarity to decide on which approach.

If you do not foresee that the requirement will be finalized anytime in the near future, I suggest that you close this "feasibility study" thread now, and create a new thread once you have all the details (please do remember to provide all the details as mentioned above when you do).

Rgds

Eng Swee