- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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 ) );
;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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 ) );
;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: action when selected
Thank you!
it works
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: action when selected
this is close to what I was looking for...to select data from one chart to generate another chart based on the rows selected. However, if I select a number of data points, say in a region of the chart, the code generates multiple subset windows.
I would quickly end up with lots of data tables open, especially with a large data set. Is there a way of preventing this happening?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: action when selected
Your specified need may be handled by using a Data Filter on the data table. You can have multiple graphs being displayed, of different types, and when the filter is applied it will change the displays in all graphs based upon the data table.
Or.....it would be a fairly simple matter, to add to your primary graph a button that when clicked, would create a new data table and chart. And, an On Close() option could be placed on the graph, that when the graph is closed, it would delete the data table that was created for it.