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


Publication date: 04/21/2023

Reference Namespaces and Scopes

There are a number of factors in resolving a named variable reference in a JSL script. Table 8.6 describes the named variable references that are resolved for specific situations.

Notes:

In JMP 9 and later, a, :a, and ::a have the same meaning with the Names Default To Here mode turned off.

If the current point of execution is in a user-defined function, or a Local or Parameter JSL function body, then the Local namespace is used for creation when Default Local is specified. However, the reference rule is unchanged.

Table 8.6 Namespace References

Form

Reference Type

Reference Rule

Creation Rule

a

Unqualified

If the Names Default To Here mode is on, JMP looks for the variable in these locations:

Local namespace

Here namespace

current data table

If the Names Default To Here mode is off, JMP looks for the variable in these locations:

Local namespace

Here namespace

Global namespace

current data table

If the Names Default To Here mode is on, then JMP creates the variable in the Local namespace or in the Here namespace.

If the Names Default To Here mode is off, then JMP creates the variable in the Local namespace or in the Global namespace.

:a

Current data table

JMP looks for the variable in the current data table.

(Not applicable)

::a

Global:a

Global

JMP looks for the variable in the Global namespace.

JMP creates the variable in the Global namespace.

ns:a

dt:a

Here:a

"name":a

expr:a

Qualified

JMP looks for the variable in the specified namespace. If the variable is not found, an error results.

JMP creates the variable in the specified namespace. Any previous values are replaced.

ns["a"]

ns[expr]

Subscript

JMP looks for the variable in the specified namespace. If the variable is not found, an error results.

JMP creates the variable in the specified namespace. Any previous values are replaced.

Platform:a

Qualified

JMP looks for the variable in the encapsulating platform.

JMP creates the variable in the encapsulating platform.

Local:a

Qualified

JMP looks for the variable within any nested local function, up to and including a function call boundary. See Example of Local:a.

JMP creates the variable in the innermost nested local function or function call boundary.

Window:a

Qualified

JMP looks for the variable in the encapsulating New Window window namespace.

JMP creates the variable in the encapsulating New Window window namespace.

Box:a

Qualified

JMP looks for the variable in the encapsulating Context Box namespace contained in a New Window window.

JMP creates the variable in the encapsulating Context Box namespace contained in a New Window window.

Example of Local:a

Sample Script

Log Output

Delete Symbols();

Local( {d1l1 = 12},

local:f1f1 = Function( {fa1, fa2},

{fl1 = 99},

local:fa12 = fa1 + fa2;

Local( {d2l1 = 56},

local:l2l2 = 78;

Show( fa12 );

Show( fl1 );

Try( Show( d1l1 ), Write( "\!n\!n***Error=" || Char( exception_msg ) || "\!n" ) );

Show Symbols();

);

local:fa12;

);

f1f1( 2, 3 );

);

fa12 = 5;

fl1 = 99;

dil1 = 12;

// Local

d2l1 = 56;

l2l2 = 78;

// 2 Local

// Local

fa1 = 2;

fa12 = 5;

fa2 = 3;

fl1 = 99;

// 4 Local

// Local

d1l1 = 12;

// 1 Local

5

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