cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
mikedriscoll
Level VI

column name problem

I have a problem in my script where JMP is not recognizing the following syntax. It works fine when I run it with the script open and hit ctrl+R or right click and run script. But if I attach the script to an addin and run from a custom menu, for some reason it is not evaluating the "column name()" correctly and I can't think of a work around. Any work-around ideas?
Thanks.

joinDt << New Column( "Failures",
Numeric,
Continuous,
Formula( Eval( Column Name( 3 ) ) + eval( Column Name( 5 )) ),
Eval Forumula );
4 REPLIES 4
mikedriscoll
Level VI

Re: column name problem

A little more detail on this: Both methods of running the script produce a data table output that are nearly identical. Running with script open and hitting ctrl+R puts the eval(column name (x)) in the formula box and it evaluates correctly.

Running the script from an addin menu produces an almost identical data table with the same formula (even if I copy / paste the formula from the output table of the script that ran correctly into the one that did not, and hit apply / ok!) but i end up with missing values.

I've seen this problem with another script, here's a snippet:
For( i = 1, i <= n, i++,
Current Data Table( limits );
If( !Excluded( Row State( i ) ),
col_name = Column Name( 1 )[/*###*/i];
...
)


Error msg:

object not subscriptable in access or evaluation of 'Subscript' , Column Name( 1 )

Running JMP9. i is a valid value here, the problem seems to be how it's handling the column name ().

Sorry, posting problems... here's the part of the code that counts:

col_name = Column Name( 1 )[/*###*/i];



Error msg:

object not subscriptable in access or evaluation of 'Subscript' , Column Name( 1 )

Running JMP9. i is a valid value here, the problem seems to be how it's handling the column name ().

Message was edited by: mjdeez
mikedriscoll
Level VI

Re: column name problem

Sorry, all my posts seem to be getting truncated...

The key part of my other script that was not working: col_name = column name(1);

Error msg:

object not subscriptable in access or evaluation of 'Subscript' , Column Name( 1 )

Running JMP9. i is a valid value here, the problem seems to be how it's handling the column name ().

Re: column name problem

I had a similar issue in a script that I had written, except mine had to do with referencing columns, not pulling their names. Running from the script window it was fine, running when embeded it didn't work. To fix it I had to include a : before all column details. Have you tried :Column Name(2)?
mikedriscoll
Level VI

Re: column name problem

Sorry for not responding to this post... in over a year now.   I was busy for a while and didn't have a chance to come back to that script I was working on. Anyhow, thank you... the solution you gave worked.   The discrepancy I was seeing where it would work when running script locally (ctrl+R) vs not work when running from the addin was a stale variable problem.   Using JMP9, the "Names default to here();" function can be used to force local.  I don't recall if I was initially clearing globals, but I know it is in there now. I don't really remember all of the details because it has been so long, but I figured it was worth an update in case anyone ever comes across something like this.