cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • 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!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

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

Apply JSL script to multiple sheets from excel

So I have an excel file with multiple sheets that have the same kind of dataframe (just different values) in each of the sheets. I was able to export a script for "Fit Y by X"

Open();

Fit Group(
	Bivariate( Y( :Total_Cost ), X( :LGP1 ), Automatic Recalc( 1 ) ),
	Bivariate( Y( :Total_Cost ), X( :iteration ), Automatic Recalc( 1 ) ),
	Bivariate( Y( :LGP2 ), X( :LGP1 ), Automatic Recalc( 1 ) ),
	Bivariate( Y( :LGP2 ), X( :iteration ), Automatic Recalc( 1 ) ),
	<<{Arrange in Rows( 2 )}
)

I'm using this script to call from python using subprocess.call([<path to jmp.exe>, <jsl_script_filepath>]).
When I execute the python code, I select my excel file and the script is being applied to only the first sheet whereas I want it to apply on all the sheets. Could someone help how I can achieve that? 

I'm using JMP14 and python3 to do the above. 

1 REPLY 1
txnelson
Super User

Re: Apply JSL script to multiple sheets from excel

If the

Open(); 

is opening all of the sheets, then the below should do what you want.

names default to here( 1 );
Open();
For( i = 1, i <= N Table(), i++,
	Data Table( i ) << Fit Group(
		Bivariate( Y( :Total_Cost ), X( :LGP1 ), Automatic Recalc( 1 ) ),
		Bivariate( Y( :Total_Cost ), X( :iteration ), Automatic Recalc( 1 ) ),
		Bivariate( Y( :LGP2 ), X( :LGP1 ), Automatic Recalc( 1 ) ),
		Bivariate( Y( :LGP2 ), X( :iteration ), Automatic Recalc( 1 ) ),
		<<{Arrange in Rows( 2 )}
	)
);
Jim

Recommended Articles