cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
dadawasozo
Level IV

Not able to close table in a for loop

Hi,

I want to use a for loop to keep import multiple files and close it after concatenate. the import multiple and concatenate is working but not the close(). I tried wait(), still not working. Not sure what I did wrong. 

dt1 = New table();
dir = {"dir1","dir2","dir3"}; //can have many dirs
for(i=1, i<= N Items(dir), i++,
	dt[i] = Multiple File Import(
	<<Set Folder( path1||"\" || dir[i] ),
	<<Set Show Hidden( 0 ),
	<<Set Subfolders( 0 ),
	<<Set Name Filter( "*.csv*;" ),
	<<Set Name Enable( 1 ),
	<<Set Add File Name Column( 1 ),
	<<Set Add File Size Column( 0 ),
	<<Set Add File Date Column( 0 ),
	<<Set Import Mode( "CSVData" ),
	<<Set Charset( "Best Guess" ),
	<<Set Stack Mode( "Stack Similar" ),
	<<Set CSV Has Headers( 0 ),

	) << Import Data,


dt1 << Concatenate(dt[i],Append to first table( 1 ));

close (dt[i],nosave); //this is the step dont seems taken effect. table not close
);

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Not able to close table in a for loop

If I remember correctly Multiple File Import returns a list and if that is the case you will have to loop over that list while closing the data tables.

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Not able to close table in a for loop

If I remember correctly Multiple File Import returns a list and if that is the case you will have to loop over that list while closing the data tables.

-Jarmo

Recommended Articles