cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar

Custom function not recognized when Graph Builder script is run via Run Script() but works when run manually

I have created a custom JSL function and loaded it into the global environment. Then, in the Graph Builder interface, I used the "Custom Script" feature to incorporate this function into the graph script. After that, I saved the Graph Builder script to the data table (as a table script).

When I manually run the Graph Builder script from the data table (by clicking the script button from the table), everything works perfectly—the custom function is recognized and the graph is generated correctly.

However, when I try to run the same table script programmatically using the Run Script() function (e.g., dt << Run Script("Graph Builder")), the script fails because it cannot find my custom function. It seems that Run Script() executes the script in an isolated context that does not have access to my globally defined function.

names default to here(1);
dt=current data table();
dt<<run script("Column 1 vs. Column 1");

AggregateHare95_0-1781704169868.png

Interestingly, built-in JMP functions are recognized fine, but my user‑defined function is not.

Has anyone else encountered this behavior? Is there a way to make Run Script() execute the table script in the same global namespace so that my custom function is visible? Any workarounds or explanations would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Custom function not recognized when Graph Builder script is run via Run Script() but works when run manually

You could prefix your function call withing your table script with :: (or global:) to access it from global namespace. You could also consider using New Custom Function /named namespace for your function and modify the table script accordingly. 

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: Custom function not recognized when Graph Builder script is run via Run Script() but works when run manually

You could prefix your function call withing your table script with :: (or global:) to access it from global namespace. You could also consider using New Custom Function /named namespace for your function and modify the table script accordingly. 

-Jarmo

Re: Custom function not recognized when Graph Builder script is run via Run Script() but works when run manually

Thanks, man! You're a genius – such a simple fix, and it worked perfectly.

Recommended Articles