Scripting Guide > JSL Building Blocks > Rules for Name Resolution > Troubleshoot Variables and Column Names
发布日期: 04/13/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];

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.

需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).