cancel
Showing results for 
Search instead for 
Did you mean: 

How to split files dynamically in SAP CPI?

shin861231
Explorer
0 Kudos
275

Hello,

I am now testing "General Splitter" function in integration flow.
The scenario is very simple. We read file from a FTP server, and we do process splitter function, finally we pass the split file to 5 different folders in different FTP servers.

Inquiry For Splitterr.jpg

Suppose there's a CSV file with 10 rows being split, and we set up Line Break in the set up of General Splitter as "2", so we expect that there will be 5 files(=10/2) generated as the result of the process.
In this case, how do we assign which split file (there are 5 of them) goes to which FTP server? I suppose we should do the setting in the adapter?

And in the first place, without using Router (which we do not think should be used because we have to set up condition), there is no way for us to connect splitter to end message event and the receiver connected to end message event.
Furthermore, if we do not know how many rows there are in the input CSV file, meaning we do not know how many files will be split as the output, how do we do this kind of dynamical setting for general splitter and receiver adapter?

Thank you in advance.

Shin

Ryan-Crosby
Active Contributor
You'd have to make use of the CamelSplitIndex. As for the splitting you cannot mix something you define statically (receivers) with an unknown dynamic quantity (splits).
Ryan-Crosby
Active Contributor
If that is what you are looking to accomplish then I imagine it should work and a test would confirm it easily enough.
View Entire Topic
shin861231
Explorer
0 Kudos

Thank you. It worked!

For anyone who wonder how the file name was set.

>File_${header.CamelSplitIndex}.csv