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
ehchandlerjr
Level V

Using script to reference another script gives error where running only second script works just fine.

Hello - I am working on two scripts, one where I make a user input box, and a second where I import an XML file. I built the XML file importer as a standalone script, and it works just fine. However, when I call it with the button script, I can't get it to work, saying 

 

Wrong result type for expression for column xsi:Schema Location 1 at row 1 in access or evaluation of 'Set Each Value' , Set Each Value( schemaLoc1 ) /*###*/ at line 1012 in jmpprj://contents/Import XRD XML.jsl

At line 982, the "schemaLoc1" doesn't seem to be picking anything up, which is why the 1012 line isn't working, but I'm not sure why calling the script from a button would mess it up unless my assignment of dt to the current data table changes, as I have the button script as a table script, while the other is just sitting in the project folder, but I can't use "show" to see what dt is for some reason.

 

Thanks!

 

Also, for the button code, I've found a few forum posts, but they don't seem to work: How do you get Number Edit Box() to return the user input when its contained in a new window command (line 7)? I've tried making it equal to a variable like the scripting guide and forum posts say, but that seems to just return  b1 = DisplayBox[NumberEditBox]; and not a value.

Edward Hamer Chandler, Jr.
2 ACCEPTED SOLUTIONS

Accepted Solutions
jthi
Super User

Re: Using script to reference another script gives error where running only second script works just fine.

Depending on how you want to get the value, either use << get inside button box or sometimes you might have to use << Set Number Changed . Below is example from Scripting Index using << Get

Names Default To Here(1);
New Window("Example", numbox = Number Edit Box(0));
Print(numbox << Get);

jthi_0-1698902223208.png

 

-Jarmo

View solution in original post

ehchandlerjr
Level V

Re: Using script to reference another script gives error where running only second script works just fine.

Just for posterities sake, the solution to the first question is that 

 

1. I had been updating a version of the script that was apparently saved separately from the version stored in my JMP Project file (and my button code was referencing the project one), so I had to start editing the project one,

 

2. An annoying mundane error: I had a column reference without the row specified, e.g. 

x = dt:Column1

instead of 

x = dt:Column1[1]

Hope this helps someone think about the small details.

Edward Hamer Chandler, Jr.

View solution in original post

4 REPLIES 4
jthi
Super User

Re: Using script to reference another script gives error where running only second script works just fine.

Depending on how you want to get the value, either use << get inside button box or sometimes you might have to use << Set Number Changed . Below is example from Scripting Index using << Get

Names Default To Here(1);
New Window("Example", numbox = Number Edit Box(0));
Print(numbox << Get);

jthi_0-1698902223208.png

 

-Jarmo
ehchandlerjr
Level V

Re: Using script to reference another script gives error where running only second script works just fine.


@jthi wrote:

Depending on how you want to get the value, either use << get inside button box or sometimes you might have to use << Set Number Changed . Below is example from Scripting Index using << Get

Names Default To Here(1);
New Window("Example", numbox = Number Edit Box(0));
Print(numbox << Get);

jthi_0-1698902223208.png

 


That did it! Had a little trouble with demonstrating with Show() that the variable changed, but once I included it in the New Window command, it worked fine.

 

Thanks a bunch!

Edward Hamer Chandler, Jr.
jthi
Super User

Re: Using script to reference another script gives error where running only second script works just fine.

Most likely there should be no need to use Current Data Table() at all as open() will return the reference to your table.

-Jarmo
ehchandlerjr
Level V

Re: Using script to reference another script gives error where running only second script works just fine.

Just for posterities sake, the solution to the first question is that 

 

1. I had been updating a version of the script that was apparently saved separately from the version stored in my JMP Project file (and my button code was referencing the project one), so I had to start editing the project one,

 

2. An annoying mundane error: I had a column reference without the row specified, e.g. 

x = dt:Column1

instead of 

x = dt:Column1[1]

Hope this helps someone think about the small details.

Edward Hamer Chandler, Jr.