Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
Stokes
Level III

How to open 1st file and analyze it, then close and open the 2nd file, etc

Hi I have a jsl want to use and run many files in different folders, then save the file with a name.

My solution is to put all the all the files path/directory into one excel file,

then run the path from row 1 to end.

There are 2 problems,

1. How to read the path file and use it to open the csv data,

2. How to save the file with a name that won't be overwritten, it can be the value of Column1,Row1,

 

Can some one give some idea how to start the jsl?

It could be something as below,

 

 

Open("C:\users\path.csv);

// open path file and read row 1,

 

Open("C:\users\............\file1.csv);

// 1st problem, this ............... path should be read from the path.csv row 1,

 

dt << save( "C:\users\file1_data1.csv" );

// after running, save the file, the 2nd problem is how to name the file, so it will not be overwrite by other files when saving, it can be random name but not be overwritten.

 

close all(Data Tables);

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: How to open 1st file and analyze it, then close and open the 2nd file, etc

Here is some psudo code that should show you the direction to take to solve your issue.

names default to here(1);

dtPath = open(Open("C:\users\path.csv");

thePath = dtPath:Column 1[1];

dtSecond = Open("C:Users\" || thePath || "\file.cvs");

myRandom = char( RandomIntiger(11111111,99999999));

dtSecond << save("c\users\" || myRandom || ".csv" );

close( dtPath, nosave );
close( dtSecond, nosave );

Since it appears that you have a desire to get into JMP Scripting, you really need to take the time to read the Scripting Guide from the JMP Documentation Library.  Your current request is solved using the very basic parts of JSL, all of which is covered in the Scripting Guide.

Jim

View solution in original post

2 REPLIES 2
Highlighted
txnelson
Super User

Re: How to open 1st file and analyze it, then close and open the 2nd file, etc

Here is some psudo code that should show you the direction to take to solve your issue.

names default to here(1);

dtPath = open(Open("C:\users\path.csv");

thePath = dtPath:Column 1[1];

dtSecond = Open("C:Users\" || thePath || "\file.cvs");

myRandom = char( RandomIntiger(11111111,99999999));

dtSecond << save("c\users\" || myRandom || ".csv" );

close( dtPath, nosave );
close( dtSecond, nosave );

Since it appears that you have a desire to get into JMP Scripting, you really need to take the time to read the Scripting Guide from the JMP Documentation Library.  Your current request is solved using the very basic parts of JSL, all of which is covered in the Scripting Guide.

Jim

View solution in original post

Highlighted
Stokes
Level III

Re: How to open 1st file and analyze it, then close and open the 2nd file, etc

Thanks Jim and suggestions.

I will dig more into the script guide.

Article Labels