- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
Message was edited by: MAD
Message was edited by: MAD
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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:
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:
[End Quote - Thanks Wendy Murphrey]
I used the second option.
[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.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Open Multiple Text Files
Created:
Mar 10, 2009 08:43 AM
| Last Modified: Sep 17, 2017 7:29 AM
(10012 views)
| Posted in reply to message from mad 03-09-2009
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" )
);
)
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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:
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:
[End Quote - Thanks Wendy Murphrey]
I used the second option.
[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.