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
xxvvcczz
Level III

How to script the datafilter GUI

I have a datafilter that is set to an empty column.

 

The idea is the user does stuff and that column gets data and the user continues until there's no missing items in that column.

 

But I've got a problem. When the data filter is set to conditional, everything looks great, but the moment the user updates the conditional column, JMP loses its mind and discards all the filter choices it had!

 

I think my "event" should capture the current filter state and then RE-SET the filter selections in order to combat this undesired "refresh"

 

The problem is I don't want to use row selection mechanics, because then the Data Fitler GUI elements will be out of sync with the user experience...

 

I went so far as to use REGEX against the "WHERE CLAUSE" element to get the filter settings I need to reset, but I can't find any mechanism to manipulate the data filter gui.

 

All the answers I've found just involve JSL scripting row states.

 

I'm in JMP 16.1

1 ACCEPTED SOLUTION

Accepted Solutions
ih
Super User (Alumni) ih
Super User (Alumni)

Re: How to script the datafilter GUI

In your example the local data filter is inside the graph builder, you have a little more flexibility if you move it to a separate element.  For example, you could delete and redraw it after your function runs, like this:

 

Names Default To Here(1);

dt = open("$sample_data\Iris.jmp");
dt << New Column( "MY_COL",Character);

break_the_filter_fn = Function( {}, 
	dt << select rows( {1, 2, 3, 4, 5} );
	dt2 = dt << Subset( Output Table( "just_some_rows" ), Selected Rows( 1 ) );
	dt2:MY_COL[{1, 2, 3, 4, 5}] = "banana";
	dt << Update( with( dt2 ), Match Columns( :sepal length == :sepal length, ) );
	close(dt2,nosave);
	a_window << Bring Window to Front;
);

a_window = New Window( "a_window",
	data filter context box(
		H List Box(
			ldflb = h list box(
				ldf = dt << data filter(
					Local,
					Conditional,
					Add Filter(
						columns( :Species, :Sepal length, :Sepal width ),
						Modeling Type( :Sepal length, Nominal ),
						Modeling Type( :Sepal width, Nominal ),
						Where( :Species == {"setosa", "versicolor"} ),
						Where( :Sepal length == {5, 5.1, 5.2, 5.3, 5.4, 5.5} ),
						Display( :Sepal length, N Items( 15 ), Find( Set Text( "" ) ) ),
						Display( :Sepal width, N Items( 15 ) )
					)
				)
			),
			MY_GRAPH_BUILDER = dt << Graph Builder(
				Size( 531, 456 ),
				Show Control Panel( 0 ),
				Variables( X( :Sepal length ), Y( :Sepal width ) ),
				Elements( Points( X, Y, Legend( 3 ) ) )
			),
			Panel Box( "a btn box",
				Lineup Box( N Col( 1 ), Spacing( 3 ),
					Button Box( "break the filter", 
						wc = ldf << get script;
						break_the_filter_fn();
						(ldflb << Child) << Delete Box;
						ldfExpr = Eval Expr( ldflb << Append( ldf = dt << Expr( Name Expr(wc) ) ) );
						Eval( ldfExpr );
					)
				)
			);
		);
	)
);

View solution in original post

4 REPLIES 4
ih
Super User (Alumni) ih
Super User (Alumni)

Re: How to script the datafilter GUI

I'm trying to understand your question, are you saying that you want 12 to stay selected if a user changes the height limits in the window below?

ih_0-1664367446525.png

Names Default To Here( 1 );

dt = Open( "$Sample_data/big class.jmp" );


dt << Data Filter(
	Location( {397, 156} ),
	Conditional,
	Add Filter(
		columns( :height, :age ),
		Where( :height >= 50 & :height <= 55 ),
		Where( :age == 12 )
	)
);

 

xxvvcczz
Level III

Re: How to script the datafilter GUI

Yes exactly, I'd like the 12 filter to stay even if the table rows are updated with new data  AND conditional is set to true

 

 

Right now JMP completely clears the data filter on table update when conditional is set to true. When conditional is off, everything is fine and the behavior is as expected.

 

So I have an existing graph and the user interacts with the graph to generate a new state for the main data table behind the graph, when the user commits the new state I create a new table with their changes and update the main table with the new table.

 

That event causes JMP to discard the filter selections they had made on the main table.

 

So what I would do is capture the data filter state before my update event, perform the update, then reset the data filter state so the user didn't notice that the filters were cleared in between.

 

This works totally fine for the data filter as long as "conditional" is set to false... 

 

But I want conditional set to true because it provides useful data in the data filter about row counts that are relevant to what they are doing.

here's my example, why does this need to reset the filter? How can I prevent the user from experiencing the filter reset?

 

Names Default To Here( 1 );

dt = Open( "$sample_data\Iris.jmp" );
dt << New Column( "MY_COL", Character );

break_the_filter_fn = Function( {}, 
	dt << select rows( {1, 2, 3, 4, 5} );
	dt2 = dt << Subset( Output Table( "just_some_rows" ), Selected Rows( 1 ) );
	dt2:MY_COL[{1, 2, 3, 4, 5}] = "banana";
	dt << Update( with( dt2 ), Match Columns( :sepal length == :sepal length, ) );
	//close(dt2,nosave);
);

a_window = New Window( "a_window",
	H List Box(
		MY_GRAPH_BUILDER = Graph Builder(
			Size( 531, 456 ),
			Show Control Panel( 0 ),
			Variables( X( :Sepal length ), Y( :Sepal width ) ),
			Elements( Points( X, Y, Legend( 3 ) ) ),
			Local Data Filter(
				Conditional,
				Add Filter(
					columns( :Species, :Sepal length, :Sepal width ),
					Modeling Type( :Sepal length, Nominal ),
					Modeling Type( :Sepal width, Nominal ),
					Where( :Species == {"setosa", "versicolor"} ),
					Where( :Sepal length == {5, 5.1, 5.2, 5.3, 5.4, 5.5} ),
					Display( :Sepal length, N Items( 15 ), Find( Set Text( "" ) ) ),
					Display( :Sepal width, N Items( 15 ) )
				)
			)
		);
		Panel Box( "a btn box",
			Lineup Box( N Col( 1 ), Spacing( 3 ),
				Button Box( "break the filter", break_the_filter_fn() )
			)
		);
	)
);

 

ih
Super User (Alumni) ih
Super User (Alumni)

Re: How to script the datafilter GUI

In your example the local data filter is inside the graph builder, you have a little more flexibility if you move it to a separate element.  For example, you could delete and redraw it after your function runs, like this:

 

Names Default To Here(1);

dt = open("$sample_data\Iris.jmp");
dt << New Column( "MY_COL",Character);

break_the_filter_fn = Function( {}, 
	dt << select rows( {1, 2, 3, 4, 5} );
	dt2 = dt << Subset( Output Table( "just_some_rows" ), Selected Rows( 1 ) );
	dt2:MY_COL[{1, 2, 3, 4, 5}] = "banana";
	dt << Update( with( dt2 ), Match Columns( :sepal length == :sepal length, ) );
	close(dt2,nosave);
	a_window << Bring Window to Front;
);

a_window = New Window( "a_window",
	data filter context box(
		H List Box(
			ldflb = h list box(
				ldf = dt << data filter(
					Local,
					Conditional,
					Add Filter(
						columns( :Species, :Sepal length, :Sepal width ),
						Modeling Type( :Sepal length, Nominal ),
						Modeling Type( :Sepal width, Nominal ),
						Where( :Species == {"setosa", "versicolor"} ),
						Where( :Sepal length == {5, 5.1, 5.2, 5.3, 5.4, 5.5} ),
						Display( :Sepal length, N Items( 15 ), Find( Set Text( "" ) ) ),
						Display( :Sepal width, N Items( 15 ) )
					)
				)
			),
			MY_GRAPH_BUILDER = dt << Graph Builder(
				Size( 531, 456 ),
				Show Control Panel( 0 ),
				Variables( X( :Sepal length ), Y( :Sepal width ) ),
				Elements( Points( X, Y, Legend( 3 ) ) )
			),
			Panel Box( "a btn box",
				Lineup Box( N Col( 1 ), Spacing( 3 ),
					Button Box( "break the filter", 
						wc = ldf << get script;
						break_the_filter_fn();
						(ldflb << Child) << Delete Box;
						ldfExpr = Eval Expr( ldflb << Append( ldf = dt << Expr( Name Expr(wc) ) ) );
						Eval( ldfExpr );
					)
				)
			);
		);
	)
);
xxvvcczz
Level III

Re: How to script the datafilter GUI

Awesome, thanks