cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
SDF1
Super User

JSL and proper referencing of a report

Dear All,

 

  I'm working on a script where I need to reference a Report window. Specifically, what I'm trying to automate is using the Simulate() function of some parameter estimates. I know that inside this report, I need to send the Simulate command to the Number Col Box(8).

 

  The problem I have is that I have a main user interface window where the user can click a button box to either Simulate the parameter estimates or Bootstrap them. The issue is that in the main window (see image below) when the user clicks on either Button Box, there is a command in my script where I'm trying to get the current report, which is open in another window.

SDF1_0-1694203023384.png

 

report window:

SDF1_1-1694203093016.png

 

But, when you click the button, the JSL command obj = Current Report() returns a reference to the main interface window NOT the report that I'm actually trying to reference. If I click on the report window and then run the script, it works.

obj = Current Report();
NBSnum = NBS << Get;
RSnum = RS << Get;
obj[Number Col Box( 8 )] << Simulate(
	NBSnum,
	Random Seed( RSnum ),
	Out( :ColumnA ),
	In( :ColumnB )
);

I have not been successful in finding a proper solution either in the Scripting Index or searching for how to properly reference the report so that the user can just click the button box in the main window.

 

Any thoughts ideas are appreciated. I imagine this should be easy, but I'm stumped right now.

 

Thanks!,

DS

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: JSL and proper referencing of a report

This might give you some ideas of what you could do

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Penicillin.jmp");

dt << Fit Model(
	Freq(:Count),
	Y(:Response),
	Effects(:"ln(dose)"n),
	Personality(Generalized Linear Model),
	GLM Distribution(Binomial),
	Link Function(Logit),
	Run
);

report_windows = Get Window List("Report");//; << Get Window Title
report_of_interest = Empty();
For Each({report_window}, report_windows,
	outline_title = Try(report_window[OutlineBox(1)] << get title, "");
	If(Starts With(outline_title, "Generalized Linear "),
		report_of_interest = report_window;
		break();
	);
);

ref = report_of_interest[OutlineBox(1)] << Get Scriptable Object;

I think you can also use the window list to determine window which was opened last (if I remember correctly it is the last one).

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: JSL and proper referencing of a report

This might give you some ideas of what you could do

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Penicillin.jmp");

dt << Fit Model(
	Freq(:Count),
	Y(:Response),
	Effects(:"ln(dose)"n),
	Personality(Generalized Linear Model),
	GLM Distribution(Binomial),
	Link Function(Logit),
	Run
);

report_windows = Get Window List("Report");//; << Get Window Title
report_of_interest = Empty();
For Each({report_window}, report_windows,
	outline_title = Try(report_window[OutlineBox(1)] << get title, "");
	If(Starts With(outline_title, "Generalized Linear "),
		report_of_interest = report_window;
		break();
	);
);

ref = report_of_interest[OutlineBox(1)] << Get Scriptable Object;

I think you can also use the window list to determine window which was opened last (if I remember correctly it is the last one).

-Jarmo
SDF1
Super User

Re: JSL and proper referencing of a report

Hi @jthi ,

 

  Great suggestion, it did work -- in fact, just getting the report_of_interest was sufficient and then I could call the report_of_interest[Number Col Box(8)] and send it the command to Simulate or Bootstrap. Worked great!

 

Thanks for the help!,

DS