cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
mad
mad
Level III

Open Multiple Text Files [SOLVED]

How do I open multiple text files? I tried to use the Open command to create a template for which columns to include, and to specify where the data begins, but I can't figure out how to pass in the file list. Any suggestions?

Message was edited by: MAD

Message was edited by: MAD
1 ACCEPTED SOLUTION

Accepted Solutions
mad
mad
Level III

Re: Open Multiple Text Files [SOLVED]

Unable to wait any longer, I submitted a trouble report and got my answer. For the benefit of others who may encounter the same problem, here is the solution:

[Quote]
According to my tests using JMP 8.0, the Open command will accept a variable. My impression is that the problem you are encountering is actually caused by the current directory being something other than C:\Test. When using the method you demonstrated, the current directory must be the same as the location of the file you are trying to open. If not, then the file may not be found.

Any easy way to handle this is to concatenate the path with the file name as in the following example:

 Open( "C:\" || files[ i ] ); 


Alternately, you can set the current directory via JSL using the Set Current Directory command:

Set Current Directory( "C:\" );

After setting the current directory, you should be able to use the Open command with only the variable:

 Open( files[ i ] ); 

[End Quote - Thanks Wendy Murphrey]

I used the second option.

View solution in original post

2 REPLIES 2
mad
mad
Level III

Re: Open Multiple Text Files

Now that I've learned how to post code, this is what I am trying to do:

files = Files In Directory("c:\Test");
for(i=1, i<= N Items(files), i++, 
	Open(files[ i ],
		columns(
			DEV_ID = Character,
			. = Omit,
			TEST = Character,
			VEE = Numeric,
			IEE = Numeric,
			. = Omit,
			. = Omit,
			. = Omit,
			IDLNA = Numeric,
			. = Omit,
			. = Omit,
			TEMP = Character,
			FREQ = Numeric,
			. = Omit,
			. = Omit,
			DB21 = Numeric,
			. = Omit
		),
		Import Settings(
			End Of Line( CRLF, CR, LF ),
			End Of Field( Comma ),
			Strip Quotes( 1 ),
			Use Apostrophe as Quotation Mark( 0 ),
			Scan Whole File( 1 ),
			Labels( 1 ),
			Column Names Start( 15 ),
			Data Starts( 16 ),
			Lines To Read( All ),
			Year Rule( "10-90" )
		);
	)
)
 

 

mad
mad
Level III

Re: Open Multiple Text Files [SOLVED]

Unable to wait any longer, I submitted a trouble report and got my answer. For the benefit of others who may encounter the same problem, here is the solution:

[Quote]
According to my tests using JMP 8.0, the Open command will accept a variable. My impression is that the problem you are encountering is actually caused by the current directory being something other than C:\Test. When using the method you demonstrated, the current directory must be the same as the location of the file you are trying to open. If not, then the file may not be found.

Any easy way to handle this is to concatenate the path with the file name as in the following example:

 Open( "C:\" || files[ i ] ); 


Alternately, you can set the current directory via JSL using the Set Current Directory command:

Set Current Directory( "C:\" );

After setting the current directory, you should be able to use the Open command with only the variable:

 Open( files[ i ] ); 

[End Quote - Thanks Wendy Murphrey]

I used the second option.