How to reference already open data table (from multiple open data tables) JSLI am working on writing scripts that create different reports and data tables. However, I always have to end up running them chunk wise and manually clicking on the drop down menu to select the data table I want to run the given chunk of script on.
I am familiar with the current data table() function, but not really anything else that doesn't require a file path.
Does anyone know any easy way to reference or select a different already open data table, perhaps by name or something?
Thanks!
Automation and ScriptingRe: How to reference already open data table (from multiple open data tables) JSLAny data table can be referenced by using the Data Table() function. Such as:
Data Table("Big Class") << Bivariate( X(:height), Y(:weight) );
One can also set a variable equal to a data table when it is created, and if the variable isn't changed in the script, it will always reference the table it was linked to.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
dt << select where( :sex == "F" );
dtFemale = dt << subset( selected columns( 0 ), selected rows( 1 ) );
rpt = New Window( "Subset of big class - Distribution of height, weight",
dtFemale << Distribution(
Continuous Distribution( Column( :height ), Process Capability( 0 ) ),
Continuous Distribution( Column( :weight ), Process Capability( 0 ) )
)
);
Wait( 0 );
dtStats = rpt["Distributions", "height", "Summary Statistics", Table Box( 1 )] <<
Make Combined Data Table;
rpt << Close Window;
dtStats << Tabulate(
Change Item Label( Statistics( Sum, "Stats" ) ),
Remove Column Label( Analysis Columns( Column 2 ) ),
Show Control Panel( 0 ),
Add Table(
Column Table( Analysis Columns( :Column 2 ) ),
Row Table( Grouping Columns( :Y, :Column 1 ) )
)
);
Other methods can be used. If you would provide a sample of the code you are using, additional help may be available.
Re: How to reference already open data table (from multiple open data tables) JSLIf you still wanted to interactively choose which table you run a script on, but wanted it to be a bit more robust, you could do something like this:
names default to here(1);
// Open a couple of tables for demo purposes
dt1 = open( "$SAMPLE_DATA/Big Class.jmp" );
dt2 = open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );
wait(0);
table_names = {};
For( i = 1, i <= N Table(), i++,
Insert Into( table_names, Data Table( i ) << get name );
);
If( N Items( table_names ) > 0,
tabSelect = New Window( "Select Table For Use",
<<MODAL></MODAL>Re: How to reference already open data table (from multiple open data tables) JSLThank you.