cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
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