cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
sciguy
Level III

Hide Local Data Filter in Graph Builder - JSL

I wanted to find out how to hide or close the local data filter in the following JSL script. What I have now is giving errors. I'm unsure of how to assign a variable to each of the Graph Builder plots in the Choose function.

 

Names Default To Here( 1 );
dt=Open("$SAMPLE_DATA/Big Class.jmp");
// Prompt for the input and create graph
rc = New Window("Choose the parameters to be plotted",
	rb = Radio Box({"Female", "Male"}),
	Button Box("Ok",
		Choose(rb<<Get,
			Graph Builder(
			Variables(X(:age), Y(:sex)),
			Local Data Filter(
				Close Outline (1),
				Add Filter( columns( :sex ), Where( :sex == "F"))
			),
			
			SendToReport(
				Dispatch(
				{},
				"age",
				ScaleBox,
				{Add Ref Line( 2.5, "Dotted", "Black", "", 3 )}
		)
	)
			
			),
			
				
			Graph Builder(
			Variables(X(:age), Y(:sex)),
			Local Data Filter(
				Close Outline (1),
				Add Filter( columns( :sex ), Where( :sex == "M"))
			),
			
			SendToReport(
				Dispatch(
				{},
				"age",
				ScaleBox,
				{Add Ref Line( 2.5, "Dotted", "Red", "", 3 )}
			)		
		)
			
			),
		);
		rb<<Close Window;
		
	)
);

// Add this line if you do not want the collapsed Local Data Filter displayed
(Graph Builder <<top parent)["Local Data Filter"]<<visibility("Collapse");

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Hide Local Data Filter in Graph Builder - JSL

You are correct.  The position where the collapsing of the Local Data Filter was, will execute before the OK button is pressed.  I was always testing the code by running everything above that line, and then running the line separately.  My error.  I have moved the line of code to a position where it is only executed after the OK button is pressed.

Names Default To Here( 1 );
dt=Open("$SAMPLE_DATA/Big Class.jmp");
// Prompt for the input and create graph
rc = New Window("Choose the parameters to be plotted",
	rb = Radio Box({"Female", "Male"}),
	Button Box("Ok",
		Choose(rb<<Get,
			gb = Graph Builder(
			Variables(X(:age), Y(:sex)),
			Local Data Filter(
				Close Outline (1),
				Add Filter( columns( :sex ), Where( :sex == "F"))
			),
			
			SendToReport(
				Dispatch(
				{},
				"age",
				ScaleBox,
				{Add Ref Line( 2.5, "Dotted", "Black", "", 3 )}
		)
	)
			
			),
			
				
			Graph Builder(
			Variables(X(:age), Y(:sex)),
			Local Data Filter(
				Close Outline (1),
				Add Filter( columns( :sex ), Where( :sex == "M"))
			),
			
			SendToReport(
				Dispatch(
				{},
				"age",
				ScaleBox,
				{Add Ref Line( 2.5, "Dotted", "Red", "", 3 )}
			)		
		)
			
			),
		);
		
		rb<<Close Window;
		(gb<<top parent)["Local Data Filter"]<<visibility("Collapse");
	)
);
Jim

View solution in original post

8 REPLIES 8
txnelson
Super User

Re: Hide Local Data Filter in Graph Builder - JSL

I think this handles what you want

Names Default To Here( 1 );
dt=Open("$SAMPLE_DATA/Big Class.jmp");
// Prompt for the input and create graph
rc = New Window("Choose the parameters to be plotted",
	rb = Radio Box({"Female", "Male"}),
	Button Box("Ok",
		Choose(rb<<Get,
			gb = Graph Builder(
			Variables(X(:age), Y(:sex)),
			Local Data Filter(
				Close Outline (1),
				Add Filter( columns( :sex ), Where( :sex == "F"))
			),
			
			SendToReport(
				Dispatch(
				{},
				"age",
				ScaleBox,
				{Add Ref Line( 2.5, "Dotted", "Black", "", 3 )}
		)
	)
			
			),
			
				
			Graph Builder(
			Variables(X(:age), Y(:sex)),
			Local Data Filter(
				Close Outline (1),
				Add Filter( columns( :sex ), Where( :sex == "M"))
			),
			
			SendToReport(
				Dispatch(
				{},
				"age",
				ScaleBox,
				{Add Ref Line( 2.5, "Dotted", "Red", "", 3 )}
			)		
		)
			
			),
		);
		rb<<Close Window;
		
	)
);

// Add this line if you do not want the collapsed Local Data Filter displayed

(gb<<top parent)["Local Data Filter"]<<visibility("Collapse");
Jim
sciguy
Level III

Re: Hide Local Data Filter in Graph Builder - JSL

I get the following error when I run this.

 

Name Unresolved: gb in access or evaluation of 'gb'

gb/*###*/

 

 

 

Thanks

jthi
Super User

Re: Hide Local Data Filter in Graph Builder - JSL

You need to add references to Graph Builders with gb.

Here is other option (I only added it to male graph builder):

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
// Prompt for the input and create graph
rc = New Window("Choose the parameters to be plotted",
	rb = Radio Box({"Female", "Male"}),
	Button Box("Ok",
		Choose(rb << Get,
			gb = Graph Builder(
				Variables(X(:age), Y(:sex)),
				Local Data Filter(Close Outline(1), Add Filter(columns(:sex), Where(:sex == "F"))),
				SendToReport(Dispatch({}, "age", ScaleBox, {Add Ref Line(2.5, "Dotted", "Black", "", 3)}))
			),
			gb = Graph Builder(
				Variables(X(:age), Y(:sex)),
				Local Data Filter(Close Outline(1), Add Filter(columns(:sex), Where(:sex == "M"))) << visibility("Collapse"),
				SendToReport(Dispatch({}, "age", ScaleBox, {Add Ref Line(2.5, "Dotted", "Red", "", 3)}))
			)
		);
		rb << Close Window;
	)
);
-Jarmo
sciguy
Level III

Re: Hide Local Data Filter in Graph Builder - JSL

Hi this code breaks the button selection. As this is actually closing the Local data filter and both plots have both M and F data in them.

 

thanks

txnelson
Super User

Re: Hide Local Data Filter in Graph Builder - JSL

I suspect you did not add the following

gb = Graph Builder(
Jim
sciguy
Level III

Re: Hide Local Data Filter in Graph Builder - JSL

Hi,

 

I copied your code as you have attached it. It is not working for me. I'm using JMP Pro 16.

 

Thanks

txnelson
Super User

Re: Hide Local Data Filter in Graph Builder - JSL

You are correct.  The position where the collapsing of the Local Data Filter was, will execute before the OK button is pressed.  I was always testing the code by running everything above that line, and then running the line separately.  My error.  I have moved the line of code to a position where it is only executed after the OK button is pressed.

Names Default To Here( 1 );
dt=Open("$SAMPLE_DATA/Big Class.jmp");
// Prompt for the input and create graph
rc = New Window("Choose the parameters to be plotted",
	rb = Radio Box({"Female", "Male"}),
	Button Box("Ok",
		Choose(rb<<Get,
			gb = Graph Builder(
			Variables(X(:age), Y(:sex)),
			Local Data Filter(
				Close Outline (1),
				Add Filter( columns( :sex ), Where( :sex == "F"))
			),
			
			SendToReport(
				Dispatch(
				{},
				"age",
				ScaleBox,
				{Add Ref Line( 2.5, "Dotted", "Black", "", 3 )}
		)
	)
			
			),
			
				
			Graph Builder(
			Variables(X(:age), Y(:sex)),
			Local Data Filter(
				Close Outline (1),
				Add Filter( columns( :sex ), Where( :sex == "M"))
			),
			
			SendToReport(
				Dispatch(
				{},
				"age",
				ScaleBox,
				{Add Ref Line( 2.5, "Dotted", "Red", "", 3 )}
			)		
		)
			
			),
		);
		
		rb<<Close Window;
		(gb<<top parent)["Local Data Filter"]<<visibility("Collapse");
	)
);
Jim
sciguy
Level III

Re: Hide Local Data Filter in Graph Builder - JSL

Thank you so much! This works perfectly.