dt << Set Property( "Bivariate Example", Bivariate( Y( :weight ), X( :height ), Fit Line ) ); // includes Fit Line in the Bivariate Example script
Suppose you want a text representation of a data table, perhaps to e-mail to a colleague or to use as part of a script. You can obtain a script that reconstructs the information in a data table with Get Script. The following example opens Big Class.jmp and prints the data, table variables, and column properties to the log. A portion of the output is shown here:
dt << Get Script;
Delete Script deletes one or more scripts.
You are prompted to open or examine downloaded data tables that contain scripts. This help you prevent potentially damaging scripts from running on your computer. In the Open() command, you can control this behavior.
To enable a Try() expression to capture the error:
You can prompt to open a table script named On Open or OnOpen when the data table opens. The choice is remembered each time you open the data table in the current JMP session.
To create an On Open script, perform one of the following actions:
•
|
Create the script using the Save Script > To Data Table option, and then double-click the property name and change the name to On Open.
|
•
|
Store the script using a New Script message.
|
In this example, you create an OnOpen script in Big Class.jmp.
dt << New Script(
sortedDt = Data Table( "Big Class" ) << Sort( By( :name ), Output Table Name( "Sorted Big Class" ) ) // sort the data and put it in a new data table
The JMP preference called Evaluate OnOpen Scripts determines when the script runs. By default, the user is prompted to run the script. You can set the preference to always run the On Open script or to prevent it from running:
On Open scripts that execute other programs are never run. As a safety precaution, you might consider suppressing automatic execution when opening data tables that you receive from others.
•
|
If the OnOpen script is in a downloaded data table, you must specify Quarantine Action( "Allow Scripts" ) in the Open() expression to run the OnOpen script automatically. See Options for Downloaded Data Tables that Contain Scripts.
|
•
|
When you create a new data table in a script and include the On Open() function, On Open() is called after the data table is created.
|
Suppose that you want to put related table scripts in a group to save room in the list of data table scripts. Use Group Scripts, specify the group name, and then specify the script names to put in the group.
dt << Group Scripts(
dt << Group Scripts(
Move Script Group rearranges the table script groups using the to first, to last, after(script), and after(group) arguments:
To get the list of table scripts in the group, use Get Script Group. Then you can perform an operation such as running a script in the group.
Get Script Groups Names returns the group names in a list:
Select Script Group selects the named table script group, a list of scripts in a group, or all scripts.
Ungroup Scripts removes specified table scripts or group from the group. You can send the message to the name of the script group or a list of scripts.
You can rename a table script group using Rename Script Group, specifying the existing group name, and specifying the new group name.