[Query] Per loop per importare il file txt e chiudere il file txt uno per unoSalve, qualcuno può insegnarmi come eseguire For loop a,
importa file txt ->
eseguire una formula ->
salva il file nella stessa cartella ->
chiudi il file ->
trova il prossimo file txt
Ho molti file, quindi non posso aprirli tutti per elaborare la formula.
Grazie in anticipo.
Tabella datiScriptingRi: [Query] Per loop per importare il file txt e chiudere il file txt uno per unoQuesto esempio può aiutare a trovare la soluzione:
// 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") );
)
);Ri: [Query] Per loop per importare il file txt e chiudere il file txt uno per unoCiao,
Solo per aggiungere a questa risposta e hai visto la funzione di importazione di più file?
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#
Ri: [Query] Per loop per importare il file txt e chiudere il file txt uno per unoGrazie a tutti e due ragazzi aiuto, lo apprezzo.