发布日期: 04/13/2021

Local Namespaces

Putting variables in the global namespace can cause conflicts. When two scripts have variables with the same names, the value of the variable in the last script that you run last overwrites the variable’s value in the first script.

To prevent this problem, we recommend that you begin each script with the following line:

Names Default To Here( 1 );

The Names Default To Here( 1 ); function makes all unscoped variables in the script local to that script and does not affect the global variable namespace. See Advanced Scoping and Namespaces.

Notes: 

The Names Default to Here setting is true by default for custom menus and toolbar buttons. A script that runs when you select a custom menu item or click a custom toolbar button does not affect global variables.

The Names Default to Here setting is false by default for table scripts. If a table script specifies Names Default to Here(1), this setting lasts only as long as the table script runs. After the script finishes running, the setting is reset to whatever it was before the script ran.

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