Scripting Guide > Data Tables > Basic Data Table Scripting > Prevent Changes to a Data Table
Publication date: 08/13/2020

Prevent Changes to a Data Table

To prevent editing cells in the data table, use Set Edit Lock with the Modify Cells argument.

dt = Open( "$SAMPLE_DATA/Big" );
dt << Set Edit Lock( "Modify Cells" );

To prevent adding or deleting columns and rows:

dt << Set Edit Lock( "Add Columns", "Delete Dolumns");
dt << Set Edit Lock( "Add Rows", "Delete Rows");

To get a list of data table operations that are locked, use Get Edit Lock:

dt << Get Edit Lock();

{"Modify Cells", "Add Rows", "Delete Rows", "Add Columns", "Delete Columns"}

To allow a specific data table operation again, use Clear Edit Lock:

dt << Clear Edit Lock( "Modify Cells" );

You can lock all three data table components (cells, columns, and rows) at once by using Lock Data Table.

dt << Lock Data Table( 1 );
Want more information? Have questions? Get answers in the JMP User Community (