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
tom_abramov
Level V

Deleting "Where" text box with JSL

Hi,

While running script with "where" function, a text box is added to report.

What is the way to delete it?

Is there some way to "not create" it instead of delete it? Because if I run Data Filter changes, the text box may come back.

Thanks,

Tom.

 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Distribution(Continuous Distribution(Column( :height )),Where( :sex == "F" ));

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: Deleting "Where" text box with JSL

The direction that @markbailey pointed you is correct.  However there is one tricky issue that needs to be exposed to get what you want properly handled.  

The        Where( :Sex == "F" )       text box is not below  the Dist Report structure.  Therefore,

dist rep = dist << Report;
dist rep(TextBox(1) << delete;

will not point to    Where( :Sex == "F" )  

One needs to move to the        DisplayBox[HeadBox]     which sits above the Report structure in the Display Tree to be able to access TextBox(1). 

Below is the syntax of the JSL to accomplish what is needed

dist = dt << Distribution( Continuous Distribution( Column( :height ) ), Where( :sex == "F" ) );
dist rep = dist << Report;

(dist rep<<topparent)[textbox(1)]<<delete;

 Another way to access       Where( :sex == "F" )       is to access it from the actual window reference

window("Big Class Where(sex == -F-) - Distribution")[textbox(1)]<<delete;
Jim

View solution in original post

4 REPLIES 4
Highlighted

Re: Deleting "Where" text box with JSL

Yes, if you save a reference to the platform:

 

dist = dt << Distribution( Continuous Distribution( Column( :height ) ), Where( :sex == "F" ) );

dist rep = dist << Report;

dist rep[Text Box( 1 )] << Delete;

I am not sure about the proper index, but you get the idea.

 

I'm curious: since this script is yours, why include the Where() argument to the launch if you con't want it? The Data Filter and Local Data Filter ds not add this text box to the report display tree.

 

Learn it once, use it forever!
Highlighted
txnelson
Super User

Re: Deleting "Where" text box with JSL

The direction that @markbailey pointed you is correct.  However there is one tricky issue that needs to be exposed to get what you want properly handled.  

The        Where( :Sex == "F" )       text box is not below  the Dist Report structure.  Therefore,

dist rep = dist << Report;
dist rep(TextBox(1) << delete;

will not point to    Where( :Sex == "F" )  

One needs to move to the        DisplayBox[HeadBox]     which sits above the Report structure in the Display Tree to be able to access TextBox(1). 

Below is the syntax of the JSL to accomplish what is needed

dist = dt << Distribution( Continuous Distribution( Column( :height ) ), Where( :sex == "F" ) );
dist rep = dist << Report;

(dist rep<<topparent)[textbox(1)]<<delete;

 Another way to access       Where( :sex == "F" )       is to access it from the actual window reference

window("Big Class Where(sex == -F-) - Distribution")[textbox(1)]<<delete;
Jim

View solution in original post

Highlighted

Re: Deleting "Where" text box with JSL

The script from @txnelson works for me in JMP 14 and JMP 15 and the text does not come back on a data filter change.  I would suggest one change, however.  Whenever possible, avoid deleting things from a JMP-created report and opt to hide them instead:

 

dt = Open("$SAMPLE_DATA/Big Class.jmp");
dist = dt << Distribution( Continuous Distribution( Column( :height ) ), Where( :sex == "F" ) );
dist rep = dist << Report;

(dist rep<<topparent)[textbox(1)]<<visibility("collapse");

JMP platforms might make assumptions about the structure of the report when options are changed and content needs to be added or removed from the report.  JMP 15 is more tolerant of content being removed, but in JMP 14 and earlier deleting the content could result in instability.

Highlighted
tom_abramov
Level V

Re: Deleting "Where" text box with JSL

Thanks Mark,
I do want "where" in the Distribution, but I dont want the text box to appear.
Article Labels

    There are no labels assigned to this post.