Scripting Guide > Data Tables > Basic Data Table Scripting > Set the Current Data Table
Publication date: 04/12/2021

Set the Current Data Table

Tip: Be careful about assuming that the data table that you want is the current data table, even if you set it to be earlier in your script, because interim actions could change that.

A data table becomes the current data table in the following instances:

When you open it like this:

dt1 = Open( "$SAMPLE_DATA/Big Class.jmp" );

When you create a new table like this:

dt2 = New Table( "Cities" );

To switch to another open data table, specify the name of the data table in Current Data Table():

dt1 = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt2 = New Table( "Cities" );
Current Data Table( dt1 ); // make Big Class.jmp the current data table

Current Data Table() can also take a scriptable object reference as an argument. The following expression would make the data table in use by the second Bivariate object the current data table:

Current Data Table( Bivariate[2] );

For more information about using references to analysis platform objects, see Send Messages to a Platform.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).