cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
SDF1
Super User

Strange error running JSL as add-in vs script.

Hi All,

 

  I have a script that I've written that I turned into an add-in. Things were working great the last time I used it, around Nov. 2023. I'm running it again, and I'm getting a very strange error/mistake that happens when I run it as an add-in, but it doesn't happen when I just run the JSL file on it's own.

 

  So, the script runs some modeling and generates an output window that is supposed to show the results of each tuning run graphically and as a table. The output is supposed to look like this (this was run from the script itself):

SDF1_0-1708632615496.png

  The output window is generated from a data table that gathers all the fit statistics from the modeling platform.

SDF1_1-1708632672311.png

  So again, the script works great and does everything it's supposed to. When I then make it as a jmpaddin file and install it in JMP, something happens and the code gets confused, and instead of referencing the output table, it goes back to the original data table that contains my Y and X's that I'm using for modeling. As a result, the graph builder portion of the output window is blank and I get an error from JMP that the :Tune Run column doesn't exist (it doesn't in the original data table, but it does in the output data table).

 

  This is the output for the same kind of modeling, but running it as an add-in instead of the JSL -- no graph builder:

SDF1_2-1708632865766.png

  And, when going to the Window List in the JMP home window, you can see that for the instance where I ran it as an add-in, it's generated the Bootstrap Forest Results window from the original data table T20-XL. So naturally there is no column :Tune Run in that data table. But, when I run it as the straight JSL, it correctly generates the output window (Bootstrap Forest Results 2) from the Summary Output data table as intended.

SDF1_3-1708632935695.png

  This is the error that I get:

SDF1_4-1708633227935.png

  And the log report shows the following:

SDF1_5-1708633319879.pngSDF1_6-1708633347003.png

 

 

  I can't figure out what's going wrong and why the add-in version is trying to work with the original data table instead of the Summary Output data table that it's supposed to. I also don't understand why it would work running it straight from the JSL file, but as an add-in it doesn't work right at all.

 

  Has anyone else come across this issue? If so, how did you correct it, and were you able to figure out how it happened in the first place?

 

Thanks!,

DS

6 REPLIES 6
jthi
Super User

Re: Strange error running JSL as add-in vs script.

Can you send the Graph Builder message to specific data table?

 

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

gb = dt << Graph Builder(
	Variables(X(:weight), Y(:height), Overlay(:sex)),
	Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
);

dt << Graph Builder(...

 

-Jarmo
SDF1
Super User

Re: Strange error running JSL as add-in vs script.

Hi @jthi ,

 

  Yes, I can, but I think the problem is something different -- something with memory allocation and assignment.

 

  The reason I think that is because I am running two instances of JMP Pro on my machine. so I have two JMP Home Windows -- the original, and then another one with [2] added to the home window name. When I try to run the add-in in the second instance of JMP, I get the error, but not when I run it in the first instance of JMP. I think there's a bug that is not handling things correctly when running a second instance of JMP.

 

  It used to not do this. I often run two instances of JMP, one to work on data in the background and the other to have available to work on new data people give me. I try to run the modeling in the second instance so that if I double click a jmp file, then it'll open in the first instance of JMP and allow me to work on that with the modeling is running in the background of the other instance. I think something might have happened in the latest update of JMP because it never had this issue before.

 

Thanks!,

DS

jthi
Super User

Re: Strange error running JSL as add-in vs script.

How are you building your add-in? Maybe forcing here namespace is making it fail as add-in (not sure why it wouldn't have happened earlier though)?

jthi_1-1708636320943.png

 

 

-Jarmo
SDF1
Super User

Re: Strange error running JSL as add-in vs script.

Hi @jthi ,

 

I build my add-in in the usual way: create a .def file, install that, and then change the toolbar as needed for the add-in. I am running my add-ins as I always have. I tried changing the "Here" namespace by unchecking or checking the box, but it doesn't seem to fix the situation in anyway.

 

After checking things again, I now can't run the add-in during a single instance of JMP. I keep getting the same errors. Perhaps it's what @Craige_Hales had commented, but if so, I am not sure how to fix the issue or why something has all of a sudden changed where the add-in malfunctions. As mentioned before, the JSL works just fine.

 

Thanks!,

DS

Craige_Hales
Super User

Re: Strange error running JSL as add-in vs script.

also see Bug or Feature?? ; it sounds like you are running into the eval context for the add-in maybe not being the same one that is used later...though from your description I'm not positive. JMP's current data table is known within an eval context. Usually there is one eval context that a script uses, and it belongs to either the JSL window or a platform window. An add-in script runs without either, so provides a transient one. When the add-in script ends (runs off the end, most likely) the transient eval context goes away. If it left a window open, and buttons in that window run more scripts, they use the window's eval context, which does not know about the previous one.

Craige
SDF1
Super User

Re: Strange error running JSL as add-in vs script.

Hi @Craige_Hales ,

 

  I'm guessing that the problem must be stemming from what you described. The final Results window that my code generates does have some buttons that perform some actions, like re-running a model fit, or relaunching the code. And, since the JSL file runs smoothly, but the add-in doesn't, it must be part of the eval thing you were talking about.

 

  What I don't understand is why is it now misbehaving when it didn't before? In addition, I'm not sure how to fix this issue as I'm not sure what started it in the first place. As mentioned, it worked just fine around Oct. 2023.

 

  All of my code is basically just a bunch of Expr() that are called and executed based on user interactions. I can share it if you'd like to see if you can reproduce the error.

 

  Could there be a JMP preference that has changed that could cause this issue? It would be nice to find a way around this, as I prefer to run it as an add-in rather than the JSL.

 

Thanks!,

DS