Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Create dynamic file Name in mediation component cSplitter?

Hi

I am new to Talend. I want to create a dynamic name for writing the files. The flow is like cFile is consuming Four files from the directory then aggregate to one File on the basis of the file name and in cProcessor again  get the list of file name and folllowed by csplitter and then again cfile genertaes 4 files with source file name and the body.

here is the code for cProcessor:

     

 

List<String> fileList = new ArrayList<String>();
fileList = (List<String>)exchange.getProperty("CamelFileName");
System.out.println("After aggregation the fileName: "+
fileList);

List<String> listBody = new ArrayList<String>();
listBody = (List<String>)exchange.getProperty("body");
System.out.println("After aggregation the body: "+ listBody);


 exchange.setProperty("FileName",fileList);

Labels (3)
1 Reply
Loko
Creator II
Creator II

You should use a java bean and use a static list of string to store your filenames, then after the split, according to the message number (1,2,3 or 4) set it the name in the list (the correct header is CamelFileName)