cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
EstelleS
Level III

Is there a way to "send" variables between different Application Builder script namespaces?

Hi everyone,

 

I'm working with Application Builder and I have lots of module windows and scripting required. I'm wondering if there is a way to "send" or "push"/"pull" variables to and from different scripting namespaces.

 

So far, I have been defining most variables on the Application namespace, but it is starting to get very busy and I would prefer to have the scripts under their relevant modules where the variables are referenced on the Application namespace as needed. One solution would be defining global variables, but I am worried about potential future problems with variable naming. Is there a way to get around this? Alternatively, is there a way to configure "Names Default to Here" or something similar so the variables I define will default to the Application namespace and can be referenced by all module scripts? 

 

I appreciate any insights!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Is there a way to "send" variables between different Application Builder script namespaces?

Hi @EstelleS -

 

Within any application script (Application-level or Module-level) you can access the Application Namespace with:

appNS = thisApplication<<Get Namespace;

With that, you should be able to explicitly set/get variable values at the Application scope.

Unscoped variables within a module script will only be visible within the given module by default.  If you need to have one module access the variables within another module, then the first module would need to have a reference to the second.  For example, you might have module1 create an instance of module2 with:

	module2 << CreateInstance(thisModuleInstance);

Variables 'thisApplication' and 'thisModuleInstance' are automatic variables that refer to the Application and (current) Module Instance.  Now, the module2 instance can access variables in the module1 instance by accessing the namespace for the module that was passed in:

OnModuleLoad({callingModule},
	ns = callingModule << Get Namespace;
);

I hope that helps!

 

-Dan

View solution in original post

1 REPLY 1

Re: Is there a way to "send" variables between different Application Builder script namespaces?

Hi @EstelleS -

 

Within any application script (Application-level or Module-level) you can access the Application Namespace with:

appNS = thisApplication<<Get Namespace;

With that, you should be able to explicitly set/get variable values at the Application scope.

Unscoped variables within a module script will only be visible within the given module by default.  If you need to have one module access the variables within another module, then the first module would need to have a reference to the second.  For example, you might have module1 create an instance of module2 with:

	module2 << CreateInstance(thisModuleInstance);

Variables 'thisApplication' and 'thisModuleInstance' are automatic variables that refer to the Application and (current) Module Instance.  Now, the module2 instance can access variables in the module1 instance by accessing the namespace for the module that was passed in:

OnModuleLoad({callingModule},
	ns = callingModule << Get Namespace;
);

I hope that helps!

 

-Dan