Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey,
I created a file in tjavarow the code is below:
File OutputFile= new File(context.main_path + "\\Successful\\" + (((String)globalMap.get("tWaitForFile_1_FILENAME")).split("\\.",2))[0] + ".csv");
if (OutputFile.createNewFile()){
System.out.println("File is created!");
}else{
System.out.println("File already exists!");
}
FileWriter writer = new FileWriter(OutputFile);
writer.write(input_row.anumber + "~" +input_row.bnumber + "~");
writer.close();
Now I want to put a header with the name of the file and a footer with the total rows. Also it prints only one row from the 23 rows. How can I write them all ? Please help me .
Use standard row names such as row1, row2 and so on instead of input_row/output_row.
For the header, something like this should work:
writer.write((((String)globalMap.get("tWaitForFile_1_FILENAME")).split("\\.",2))[0] + ".csv");
// declare line counter
int counter = 0;
// don't close the file
// writer.close();
In the main part, add 1 to the counter and write the content of current row:
counter++;
// write content
writer.write(row1.anumber + "~" row1.bnumber + "~" + row1.whatYouWant + "~" + "...and so on...");
Then in the footer you can write the counter value and close the output file:
writer.write("" + counter);
writer.close();
This should be ok for your use case (or not too far, I didn't try it).
Can tjavaflex read input_row ? Also I dont know how to write the header and the footer. Is it possible to show me?
Use standard row names such as row1, row2 and so on instead of input_row/output_row.
For the header, something like this should work:
writer.write((((String)globalMap.get("tWaitForFile_1_FILENAME")).split("\\.",2))[0] + ".csv");
// declare line counter
int counter = 0;
// don't close the file
// writer.close();
In the main part, add 1 to the counter and write the content of current row:
counter++;
// write content
writer.write(row1.anumber + "~" row1.bnumber + "~" + row1.whatYouWant + "~" + "...and so on...");
Then in the footer you can write the counter value and close the output file:
writer.write("" + counter);
writer.close();
This should be ok for your use case (or not too far, I didn't try it).
Did this help?
If so, thanks to mark your case as solved (Kudos also accepted).