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
ih
Super User (Alumni) ih
Super User (Alumni)

Select values from report table or clipboard in local data filter

Is there a way to interactively select values from a table (data table or table in a report) and transfer those into a local data filter?

 

Asking another way: it is straight forward to get values into a one-per-line list into the clipboard, can those be somehow selected in local data filter, or is there an alternate way to do this?

 

Here is an example workflow:

Values to Local Data Filter.gif

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Select values from report table or clipboard in local data filter

There may be better ways to do this, but here is my take on it.  If you create a separate window, with just a Button Box() in it, clicking on the button will run a simple script that can change the filter

select1.PNG

Here is the script that produces the above example

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
dis = dt << Distribution( continuous Distribution( Column( :height ) ) );
lf = dis << Local Data Filter( Add Filter( columns( :name ), Mode( Show( 1 ), Include( 1 ) ) ) );
	
	
nw = New Window( "Set Values",
	Button Box( "Click to Set Selection From Selected Rows",
		theRows = dt << get selected rows;
		If( N Rows( theRows ) > 0, 
		
			theWhere = ":name == \!"" || dt:Name[theRows[1]] || "\!"";
			For( i = 2, i <= N Rows( theRows ), i++,
				theWhere = theWhere || " | :name == \!"" || dt:Name[theRows[i]] || "\!""
			);
			lf << delete all;
	
			Eval( Parse( "lf << add filter (Columns (:name), where( " || theWhere || " ) );" ) ),
			lf << delete all;
			lf << add Filter ( Columns (:name));
		);
	)
);
Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: Select values from report table or clipboard in local data filter

There may be better ways to do this, but here is my take on it.  If you create a separate window, with just a Button Box() in it, clicking on the button will run a simple script that can change the filter

select1.PNG

Here is the script that produces the above example

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
dis = dt << Distribution( continuous Distribution( Column( :height ) ) );
lf = dis << Local Data Filter( Add Filter( columns( :name ), Mode( Show( 1 ), Include( 1 ) ) ) );
	
	
nw = New Window( "Set Values",
	Button Box( "Click to Set Selection From Selected Rows",
		theRows = dt << get selected rows;
		If( N Rows( theRows ) > 0, 
		
			theWhere = ":name == \!"" || dt:Name[theRows[1]] || "\!"";
			For( i = 2, i <= N Rows( theRows ), i++,
				theWhere = theWhere || " | :name == \!"" || dt:Name[theRows[i]] || "\!""
			);
			lf << delete all;
	
			Eval( Parse( "lf << add filter (Columns (:name), where( " || theWhere || " ) );" ) ),
			lf << delete all;
			lf << add Filter ( Columns (:name));
		);
	)
);
Jim
txnelson
Super User

Re: Select values from report table or clipboard in local data filter

Another thought,

This could be automated by applying a Row State Handler on the data table.  Anytime a rowstate changed, it would trigger the running of the code that is currently in the Button Box, and update the local filter.

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

Re: Select values from report table or clipboard in local data filter

Looks like it will be an add-in with your button-box script to the rescue!

 

Thank you @txnelson.  Will leave the post 'unsolved' for a bit just in case anyone comes up with no-script solution...