Hi, can someone teach me how to run For loop to,
import txt file -->
run a formula -->
save the file in the same folder -->
close the file -->
find next txt file
I have many files, so can't open all of them to process the formula.
Thanks in advance.
This example May help to find the solution:
// Initialization Names Default To Here( 1 ); clear log(); // prepare source and destination directory show(get path variable("SAMPLE_IMPORT_DATA")); show(get path variable("TEMP")); basepath_str = "$SAMPLE_IMPORT_DATA"; resultpath_str = "$TEMP" || "\jmp\"; // create folder for destination if not existing If( Directory Exists( resultpath_str ), , Create Directory( resultpath_str ) ); // read filelist f_lst = Files In Directory( basepath_str ); // go through all csv files, open, add formula and save dt_lst = {}; For( i = 1, i <= N Items( f_lst ), i++, If( Ends With( f_lst[i], "csv" ), cdt = Open( basepath_str ||"\"|| f_lst[i] ); Insert Into( dt_lst, cdt ); Show( cdt ); cdt << New Column( "Formulat_row", Formula( Row() ) ); cdt_fullfilename = resultpath_str || (cdt << get name) || ".jmp"; // Close( cdt, save( resultpath_str || (cdt << get name) || ".jmp") ); ) );
Hi,
Just to add to this response, and you seen the Multiple File Import feature?
https://www.jmp.com/support/help/en/15.1/?os=win&source=application&utm_source=helpmenu&utm_medium=application#page/jmp/import-multiple-files.shtml#
Thanks both of you guys help, I appreciate it.