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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

spliting files an renaming files

Hi,
I'm new on Talend.
I'm trying to create a file for each row I have in my database and want to rename each file whith a unique variable I have in the row.
My input file is a mysql database, I use a tmap before spliting in multiples files using xmloutput composant.
I try to put a variable in the "+("row1.id")+".xml", I have a null1, null2, null3 ....
Thanks for help
Sorry for my english
Labels (4)
20 Replies
Anonymous
Not applicable
Author

Hello,
I still need help
Thanks
Anonymous
Not applicable
Author

Hello
tMysqlInput---row1-->tFlowToIterate---iterate-->tAdvancedOutputXML
on tFlowToIterate, generate each row.
set the file as:
"..."+row1.id+".xml"
If you still have any trouble, please give us an example of your request.
Best regards
Shong
Anonymous
Not applicable
Author

hello
Thanks for your help.
I can't see how I can change my job with your solution
Here is my flow
Anonymous
Not applicable
Author

hello,
I still need help
I'm not the only one with this issue
https://community.talend.com/t5/Design-and-Development/Generate-an-XML-file-per-row-Root-and-row-tag...
Thanks
Anonymous
Not applicable
Author

I see your issue. you cannot connect an iterate link to a tFileOutputXML. To make this work, use a tJavaFlex to read from the iterate link one row at a time.

dbInput --> tMap --> tFlowToIterate --> tJavaFlex --> tFileOutputXML
in your tJavaFlex, propogate the data with this code in the MAIN section:
BEGIN SECTION: 
<empty>
MAIN SECTION:
row2.newColumn = globalMap.get("row1.newColumn").toString();
END SECTION:
<empty>

in my example row2 is the output row of the tJavaFlex and row1 is the input row to my tFlowToIterate. you will need to replace that with what your output/input rows are.
in the tFileOutputXML use this code in the File Name field:
/file_example/file_header_" + globalMap.get("row1.newColumn").toString() + ".xml"
Anonymous
Not applicable
Author

hello,
thanks for your help !
I followed your solution, I made some screenshot.
I have an error on the tjavaflex, don't know why

Thanks
The error :
connecting to socket on port 3561
connected
Exception in component tJavaFlex_1
java.lang.NullPointerException
at webedition.test_0_1.test.tMysqlInput_2Process(test.java:8742)
at webedition.test_0_1.test.runJobInTOS(test.java:10732)
at webedition.test_0_1.test.main(test.java:10593)
disconnected
Job test terminé à 14:02 08/10/2010.
Anonymous
Not applicable
Author

It looks like you are referencing the wrong row varibles in the tJava flex. The input to your tFlowToIterate is row11, the output of the java flex is row10.
change your code from this:
row11.EAN = globalMap.get("row6.gdl_ean").toString();
to this:
row10.EAN = globalMap.get("row11.gdl_ean").toString();
Anonymous
Not applicable
Author

thanks but it doesn't work
I haven't go any row10 in my tmap. Is it normal ?
And row11 is before row 10 in the flow, is it a problem ?
Anonymous
Not applicable
Author

it dosnt matter what the input and output are called, just that they are referenced correctly. I've uploaded your screenshot with input and output highlighted.
<OUTPUT_ROW_VAR>.<OUTPUT_COLUMN_NAME> = globalMap.get("<INPUT_ROW_VAR>.<INPUT_COLUMN_NAME>").toString();