Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I would like to iterate a hashMap or an arrayList in talent open studio, and, for each iteration, I would like to write a new csv row! I've done many tests but the result I get is the override of the first line. Below i post an example.
The tSetGlobalVar_1component creates the arrayList.
The tJvava_1 component inserts values to arrayList.
The tLoop_1 component loop to arrayList from 1 to arrayList.size
The tJavaFlex_1 component get the ArrayList from globalMap and iterare throw it and for each iteration, write the the row to cor column in row1
The tFileOutputDelimeted_1 has one column "code".
The output csv file, in the end, has only one row with last value of arrayList.
Could someone help me?
Thanks!!!
Check the 'Append' box on tFileOutputDelimited to append rows to an existing file.
Hi
You need to set a dynamic output file name on tFileOutputDelimited, eg:
"D:/file/"+(String)myList.get(((Integer)globalMap.get("tLoop_1_current_iteration"))-1)+"out.csv"
otherwise, the component always create a new file with the same name for each iteration.
Hope it helps you.
Regards
Shong
Hi @Shicong Hong and thanks for yours reply, i don't want to generate more files, i would to generate one csv file with more rows at the same column.
Check the 'Append' box on tFileOutputDelimited to append rows to an existing file.
I have checked the 'Append' box but nothing has changed
For testing, add a tLogRow before tFileOutputDelimited to print the value on the console to see if it has the expected output data.
Hi @Shicong Hong , i checked the "append box" in base settings of tFileOutputDelimted_1 and now it works!
I selected the wrong checkbox (row_mode in advanced settings), the Italian translation fooled me! A thousand thanks.
Glad to hear that, thanks for your feedback!