For the latest version of JMP Help, visit JMP.com/help.

Scripting Guide > JSL Building Blocks > Rules for Name Resolution > Troubleshoot Variables and Column Names
Publication date: 09/28/2021

Troubleshoot Variables and Column Names

When you reference a column name using As Name(), and Names Default To Here( 1 ) is set, JMP returns a variable reference. That reference is then processed using the standard reference rules.

In the following example, there is no height variable in the Here: scope, so JMP returns an error.

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
As Name( "height" )[3]; // converts height to a variable reference

As Name( "height" )[/*###*/3];

The /*###*/ characters in the log indicate the location of an error in the script execution.

To prevent this problem, use one of the following methods:

Use As Column() instead of As Name():

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
As Column( "height" )[3]; // converts height to a data column reference

Explicitly scope height with As Name():

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt:( As Name( "height" ) )[3]; // scopes height as a data column reference

These scripts return 55, the value of height in the third row of Big Class.jmp.

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