I am running JMP 17.1 and have the script shown below which works thanks to @jthi help. When I run the script, I get a table box of Big Class.jmp in a window and I can select a row and it returns the values of Height and Weight from the selected row. In my real world application, I have a much larger table that I'd like to filter down by right-clicking in the window and choosing "Filter Where...". When I get the filtered table in the Table Box, sometimes the selected row returns the data and other times it returns an error that says "Subscript problem in access or evaluation of 'hvals[/*###*/sel], hvals[/*###*/sel]". In my example below, I right-click on the Big Class Table Box and Filter by sex == F.
Any ideas on how I can retrieve data for each of the rows of the subset table box without an error?
names default to here(1);
//run this now
dt = open("$sample_data\big class.jmp", invisible);
rpt = dt << select where(row() <= 10) << get as report;
tb = rpt[Table Box(1)];
tb << Set Selectable Rows();
tb << set row change function( Function( {this}, sel = this << get selected rows ) );
sel = tb << get row change function;
nw = new window("test",
v list box(
outline box("Big Class", rpt),
text box("Click 'OK' to choose height and weight"),
Button box("OK",
hvals = tb[NumberColBox("height")] << get;
wvals = tb[NumberColBox("weight")] << get;
ht = hvals[sel][1];
wt = wvals[sel][1];
print(sel, ht,wt);
)
)
);
Below are images of the original table (first 10 rows of Big Class), the Big class table after filtering by sex and choosing the row where the error first occurs, and the error message. Please note that the script works on the filtered table on the first 5 rows but not on rows 6 or 7.