Scripting Guide > Data Tables > Add Metadata to a Data Table
Publication date: 07/08/2024

Add Metadata to a Data Table

Data tables store observation data, or measurements of various variables on a specific set of subjects. You can use JSL to also store metadata, or data about the data, in a data table.

Data Table Variables

Table Scripts

Evaluate Formulas in Data Tables

Delete Metadata

Data Table Variables

Table variables store a single text string value in a data table, such as “Notes”. To understand how variables work in JSL, first get a variable’s existing value by sending a Get Table Variable message:

dt = Open( "$SAMPLE_DATA/Solubility.jmp" );
dt << Get Table Variable( "Notes" );

"Chemical compounds were measured for solubility in different solvents. This table shows the log of the partition coefficient (logP) of 72 organic solutes in 6 aqueous/nonpolar systems."

Now change the existing value of the string using Set Table Variable and then use Get Table Variable again to check that the string has been updated:

dt << Set Table Variable( "Notes", "Solubility of chemical compounds" );
dt << Get Table Variable( "Notes" );

"Solubility of chemical compounds"

The following example adds two new table variables to a data table:

dt = Open( "$DOCUMENTS/Big Class.jmp" );
myvar = "This is my version of the JMP Big Class sample data.";
dt << Set Table Variable( "key1", myvar );
dt << Set Table Variable( "key2", myvar );

Notice that setting the value creates a new variable only if one by the given name does not already exist. If you add two table variables with the same name, only one variable is created.

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