cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Samu
Level II

Get a jrp like script from a report window

Hello everyone,

I am trying to save my report script to a jrp file as explained in: Save charts as ".jrp" file in JSL 

However, I don't have direct access to the Graph Builder that generated my Report Window.

I'm getting my reports via 

Get Window List(Type("Reports"));

And now I need to extract the script to save it as a text file, however I can't figure out how to get that script.

When using << Get Script I only end up with things like 

GraphBuilderBox(ScaleBox(ParallelScaleBox(ScaleBox(ScaleBox(ScaleBox(ScaleBox(ScaleBox(ScaleBox(GraphBuilderContainerBox(Graph[...]

How do I get a text that's more like

Graph Builder(
 Size( 1896, 975 ),
 Show Control Panel( 0 ),
 Show Legend( 0 ),
 Variables(...

?

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Get a jrp like script from a report window

The "Get Window List" returns the Top Parent for the window.

The "Get Scriptable Object" is a message to an Outline Box().  Therefore, this modification should get you what you want.

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/big class.jmp" );
dis = Distribution( Continuous Distribution( Column( :height ) ) );

x = (Get Window List( Type( "Reports" ) )[1][Outline Box( 1 )] << get scriptable object());

x << get script;

 

 

Jim

View solution in original post

8 REPLIES 8
Jeff_Perkinson
Community Manager Community Manager

Re: Get a jrp like script from a report window

Take a look at the Get Scriptable Object() message. You can use that to get access to the platform (i.e., Graph Builder) in a report.

 

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = bivariate( y( :weight ), x( :height ) );
rbiv = biv << report;
bivobj = rbiv << Get Scriptable Object();
bivobj<<get script();

 

 

-Jeff
Samu
Level II

Re: Get a jrp like script from a report window

Thank you for the reply. However I didn't manage to solve my issue yet.

After opening an existing .jrp file, which in turn opens a data table and a report window, the following scripts:

wList = Get Window List(Type("Reports"));
print(wList[1] << report << Get Scriptable Object() << get script());
wList = Get Window List(Type("Reports"));
print(wList[1] << Get Scriptable Object() << get script());

will both result in

HeadBox(V List Box(Box(OutlineBox(H List Box(NoCloneBox(IfBox(H List Box(V List Box(H List Box(ButtonBox, ButtonBox, ButtonBox), BorderBox(V List Box(H List Box(PopupBox, Text Box("40 Columns")), V List [... etc.]

Not the kind of script I am looking for. This seems to be a special case, since I'm starting with an existing report window. What am I doing wrong?

Jeff_Perkinson
Community Manager Community Manager

Re: Get a jrp like script from a report window

It could be that your messages in:

 

 

print(wList[1] << report << Get Scriptable Object() << get script());

aren't being executed in the order you think they are.

 

 

Compare the results of these two:

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = bivariate( y( :weight ), x( :height ) );
rbiv = biv << report;
Print( (rbiv << Get Scriptable Object()) << get script() );

Print( rbiv << Get Scriptable Object() << get script() );

 

-Jeff
Samu
Level II

Re: Get a jrp like script from a report window

Interesting. By doing it step by step like this:

wList = Get Window List(Type("Reports"));
rep =  wList[1] << report;
so = rep << Get Scriptable Object();
skr = so << get script();
Print( skr );

 I am now getting error messages that Object 'HeadBox' does not recognize the message 'report'; as well as Object 'HeadBox' does not recognize the message 'Get Scriptable Object'; if I cut the report message. So Get Window List(Type("Reports")); gets me a headbox that can only recognize Get Script, which in turn gives me the same old

HeadBox(V List Box(Box(OutlineBox(H List Box(NoCloneBox(IfBox(H List Box

I already learned something, but I'm still not there yet. How do I get the Scriptable Object of my window?

txnelson
Super User

Re: Get a jrp like script from a report window

The "Get Window List" returns the Top Parent for the window.

The "Get Scriptable Object" is a message to an Outline Box().  Therefore, this modification should get you what you want.

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/big class.jmp" );
dis = Distribution( Continuous Distribution( Column( :height ) ) );

x = (Get Window List( Type( "Reports" ) )[1][Outline Box( 1 )] << get scriptable object());

x << get script;

 

 

Jim
Samu
Level II

Re: Get a jrp like script from a report window

Thank you very much, that did it!

Re: Get a jrp like script from a report window

This little nugget should be in the JSL Cookbook!  Thanks @txnelson !  @DonMcCormack 

Re: Get a jrp like script from a report window

Thanks @MikeD_Anderson! I agree, it would make a good addition.