cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
whom
Level II

Strange JMP Scripting error

I have a new script that I'm trying to debug.  I have two nested loops.  Outer loop goes from 1 to 900; inner loop goes from 1 to 9000.  The variables are i and j, respectively.

I am looking for specific conditions with the data, and when met, I need to update a column x, in the jth row of a data file, with the value "Y".   Using SHOW statements, it looks like the script is working fine.  However, when I actually try to update x it looks like JMP is not recognizing the value of "j", even though I'm well within the limits of the loop.  Let suppose j=451.   If I hardcode x[451] = "Y", the script works ok.  If the script runs with x = "Y", the code doesn't execute.  Does anyone see what I'm doing wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Strange JMP Scripting error

Maybe the current data table is not the one you think it is. For example if the script generate temporary subsets or summaries, it's easy to lose track of the front table. Then it is good practice to address columns via a variable or excplicitly specify the table of the column.

With variable:

col=Column(dt, "NumberFlag");

col[k]

Or directly:

Column(dt, "NumberFlag")[k]

View solution in original post

6 REPLIES 6
MTOF
Level III

Strange JMP Scripting error

Hi "whom"

Try using k instead of j.

J is also an inbuilt jsl function, an even if you try to tell JMP you don't mean the function J but variable ::j it doesn't seem to work. At least that's my experience - I'm still in JMP 8.0.2, this might be different in version 9.

BR, Marianne

whom
Level II

Strange JMP Scripting error

No, that didn't work.

I have a column in the data table called NumberFlag.  I'm trying to access specific rows with code such as  NumberFlag.  The error message i'm getting is:

Name Unresolved: NumberFlag in access or evaluation of 'NumberFlag' , NumberFlag

ms
Super User (Alumni) ms
Super User (Alumni)

Strange JMP Scripting error

Maybe the current data table is not the one you think it is. For example if the script generate temporary subsets or summaries, it's easy to lose track of the front table. Then it is good practice to address columns via a variable or excplicitly specify the table of the column.

With variable:

col=Column(dt, "NumberFlag");

col[k]

Or directly:

Column(dt, "NumberFlag")[k]

whom
Level II

Strange JMP Scripting error

Thanks MS!!!

Looks like this did the trick.   I think JMP was getting confused because I was actually trying to reference columns in two separate data files.   The last DT reference was for Data file 2, but in the situation originally documented, I was trying to FIRST access a field in Data file 1.  Once I updated the script as you suggested, things worked well.    Phew!

MTOF
Level III

Strange JMP Scripting error

Are you creating the column NumberFlag in the script?

Could it be that the creation of the column (or population of values) is not finished when you try to access the values? Then a wait(0) might help?

If it contains a formula, adding 'eval formula' at the end of the new column might also help.

new column("NumberFlag", character, formula(if(:Result<5, "Low", "High")), eval formula);

whom
Level II

Strange JMP Scripting error

MarianneT,

Yes, the columns are created at the beginning of the script, but the processing/access takes place towards the end, with quite a bit of processing of other data fields, in the middle.  I ran the script in logical piecemeal sections, just to make sure things were completing correctly.  MS's suggestion above worked.  However, Thanks for the followup comments!