[Consulta] Para el bucle para importar el archivo txt y cerrar el archivo txt uno por unoHola, ¿alguien puede enseñarme cómo ejecutar el bucle For,
importar archivo txt ->
ejecuta una fórmula ->
guardar el archivo en la misma carpeta ->
cierra el archivo ->
encontrar el siguiente archivo txt
Tengo muchos archivos, así que no puedo abrirlos todos para procesar la fórmula.
Gracias por adelantado.
Tabla de datosScriptingRe: [Consulta] Para el bucle para importar el archivo txt y cerrar el archivo txt uno por unoEste ejemplo puede ayudar a encontrar la solución:
// 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") );
)
);Re: [Consulta] Para el bucle para importar el archivo txt y cerrar el archivo txt uno por unoHola,
Solo para agregar a esta respuesta, ¿y ha visto la función Importar múltiples archivos?
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#
Re: [Consulta] Para el bucle para importar el archivo txt y cerrar el archivo txt uno por unoGracias a los dos por ayudarme, lo agradezco.