BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
shiro

Occasional Contributor

Joined:

May 21, 2018

action when selected

Hey,

I want to know if it is possible to call a function or an action  when rows are selected in the data table.

for example- when the user push a button it will lead to other actions to happen, I want it to happen when to user select a value in a Bivariate chart. 

 

Thank you for the help.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Re: action when selected

When a value is selected in a graph that is displaying individual data points, JMP's default action is to set the row(s) in the data table that for that data point to have a Row State value of Selected.  If a Row Stat Handler has been applied to the data table, using a Make Row State Handler() function, then the above change in the Row State for a column will trigger the function referenced in the Make Row State Handler.

Here is an obsurd example to illustrate how it works. It opens up the Big Class data table, and displayes a Bivariate Plot.  If you select a data point in the displayed graph, a new data table will be created.  The new data table will contain the data from the row the selected data point is from.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
f = Function( {a},
	If( N Rows( dt << get selected rows ) > 0,
		dt << subset( selected rows( 1 ), selected columns( 0 ) );
		Current Data Table( dt );
		dt << bring to front;
	)
);
rs = dt << make row state handler( f );

biv = dt << Bivariate( Y( :height ), X( :weight ) );
;
Jim
4 REPLIES 4
txnelson

Super User

Joined:

Jun 22, 2012

Re: action when selected

Yes you can.  You can set a "Row State Handler" that will be triggered anytime something is changed in the "Row State" column of the data table, such as selection, or setting a color, or excluding....etc.

See the Scripting Index for an example of how to use "Make Row State Handler"

     Help==>Scripting Index==>Data Table==>Make Row State Handler

Jim
shiro

Occasional Contributor

Joined:

May 21, 2018

Re: action when selected

Thank you!

I tried to use the example in the Scripting Index but it seems to work only when I choose a filter,
I want it to work when I choose one or more dots on the graph.
is it possible?

Thank you

txnelson

Super User

Joined:

Jun 22, 2012

Solution

Re: action when selected

When a value is selected in a graph that is displaying individual data points, JMP's default action is to set the row(s) in the data table that for that data point to have a Row State value of Selected.  If a Row Stat Handler has been applied to the data table, using a Make Row State Handler() function, then the above change in the Row State for a column will trigger the function referenced in the Make Row State Handler.

Here is an obsurd example to illustrate how it works. It opens up the Big Class data table, and displayes a Bivariate Plot.  If you select a data point in the displayed graph, a new data table will be created.  The new data table will contain the data from the row the selected data point is from.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
f = Function( {a},
	If( N Rows( dt << get selected rows ) > 0,
		dt << subset( selected rows( 1 ), selected columns( 0 ) );
		Current Data Table( dt );
		dt << bring to front;
	)
);
rs = dt << make row state handler( f );

biv = dt << Bivariate( Y( :height ), X( :weight ) );
;
Jim
shiro

Occasional Contributor

Joined:

May 21, 2018

Re: action when selected

Thank you!

it works