Subscribe Bookmark RSS Feed

Associative array JMP addin

vishwasanj

Frequent Contributor

Joined:

Dec 27, 2016

The script runs perfectly fine by itself.

But when I make it into a jmp addin, it runs till creating the final table but it stops after that.

 

 

Basically in my script, when you run, it asks the user for the file1 and then the file 2. Once the user give both the files, it merges the file and spits out graphs in the designated folder.

Like I said, If I just run it as a script I have no problem.

But after creating the JMP addin, it stops right after concatenation of the 2 tables. It doesn't get into the associative array of the final table and do the computation.

I have the addin.def, addin.jmpcust and the .jsl file in the folder.

 

 

Is there anything I need to update with respect to associative array for the "for" loop when I am trying to run through JMP addin?

 

I really appreciate the help. Thank you

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

Solution

It can be tricky debugging things that work when run as a script but fail as an add-in. 

 

The first thing to do is to see if there are any error messages in the Log window after running your add-in. If there are that will give you (and us) a clue about the problem.

 

You can also instrument your code with show() statements in various sections to begin to narrow down which section is failing.

 

Try those steps and let us know your results here.

-Jeff
4 REPLIES
Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

Solution

It can be tricky debugging things that work when run as a script but fail as an add-in. 

 

The first thing to do is to see if there are any error messages in the Log window after running your add-in. If there are that will give you (and us) a clue about the problem.

 

You can also instrument your code with show() statements in various sections to begin to narrow down which section is failing.

 

Try those steps and let us know your results here.

-Jeff
vishwasanj

Frequent Contributor

Joined:

Dec 27, 2016

Thank you for the reply Jeff.

I did find an error running the jmp addin in log window.

I have an expression which says where( Wafer == Expr( currentwafer ) ) and run through all wafer numbers in a loop.
This Where-clause for data table 'Final table' resulted in no rows: Wafer == "11" //(I do have rows for wafer 11)
Send Expects Scriptable Object{1} in access or evaluation of 'Send'

I don't get this error when I am just running as a script.

Any thoughts?
vishwasanj

Frequent Contributor

Joined:

Dec 27, 2016

Fixed it. Had to reference it again to the data table.

Thank you so much.
Eric_Hill

Staff

Joined:

Oct 1, 2013

A big difference between just running a script and running a script as an add-in is that scripts running as add-ins (and, more generally, scripts that run from menu customizations) are executed by default with Names Default To Here(1), whereas when you just run a script, if you haven't explicitly added Names Default To Here(1) to your script, the global namespace is used.  You can control this difference via the Menu Editor:

 

scripts_here.png

 

That box is checked by default.  My suggestion going forward is, if you have a script that runs fine on its own but fails when run via a custom menu item, try unchecking that box and see if that fixes the problem.  If it does, look for scoping issues in your script (and it sounds like that's what you found).  Another thing you can do is to get in the habit of adding Names Default To Here(1) as the first line of all your scripts, and then they should behave the same whether run on their own or as part of an add-in.  

 

Why not just uncheck the box and leave it unchecked?  Well, it is good practice to use the Here namespace to keep scripts from having unintended side effects on other scripts and add-ins.

 

HTH,

 

Eric