Hi All,
I'm struggling with OnClose statements for adding items to a list when a data view table is closed. The idea is a user will select rows (already done in this script) and edit values on the data view, which will log the change to those values on a list variable when it's closed.
I'm not having much luck with this, even something as simple as DT<<On Close(Write("Test")); doesn't work!
Any help is appreciated!
Ben
names default to here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Select Rows( [5, 7, 8, 10] );
OG_tablerows=dt<<get selected rows();
//create a Data View of the selected rows for editing
dataview_window=dt<<data view;
//get the rows in the DV table
dv_tablerows=dataview_window<<get selected rows();
//Fresh blank the X and Yval stores
pre_edit_xval={};
pre_edit_yval={};
pre_edit_rows={};
//Variables to store the list of edits that have been made (stored at the beggining of the script elsewhere)
post_edit_xval_history={};
post_edit_Yval_history={};
post_edit_row_history={};
//Warning window
dataviewwarning_window=New Window( "Please Select Rows", <<Modal, Text Box("After editing the rows please close the data window to log the changes"));
//When the dataview has been booted up it records what the original values were
insert into(pre_edit_xval,dataview_window:height[dv_tablerows]);
insert into(pre_edit_Yval,dataview_window:weight[dv_tablerows]);
insert into(pre_Edit_rows, OG_tablerows);
//THE CHALLENGE - Set up on close statement to insert the pre_edit values into the historical list
Eval(
Eval Expr(
dataview_window << onclose(
Expr( dataview_window ) << setdirty( 0 );
insert into(post_edit_xval_history, pre_edit_xval);
insert into(post_edit_Yval_history, pre_edit_Yval);
insert into(post_edit_row_history,pre_edit_rows);
insert into(movehistory, "Edited");
movecounter++;
1;
)
)
);