How to save a file with name as a variable in For loop to save multiple files
Aug 27, 2020 5:34 PM
| Last Modified: Aug 28, 2020 6:56 AM(169 views)
Hi, I am trying to save files in a for loop, the problem is how to put a variable into the file saving procedure,
However, it looks the file save part is not working.
I didn't use any clear global to make sure filename has be assigned with the original value.
Is there any problem with my saving part?
// filename is a variable assigned below,
For( j = 1, j <= N Row( sdt ), j++,
filename = Column( sdt, "file" )[j];
Close( Data Table( sdt ), No Save );
// During saving the file, the directory is fixed, however the filename is an variable, // the goal is to use the left(filename,18) and concatenate with "_Type1" in the file name.
dt1 = Current Data Table();
dt1 << save( "C:\Users\file\JSL\"||Right( filename,18)||"_Type1.csv" );