Hi, Many thanks,
Yes, that is what (reading Scripting Guide) I am doing now a day.
I an getting following error in the script you send me on Friday. Any help
Also why do we use "__" in specs limits like LSL. I was trying to find answer in jmp script guideline but could not understand much.
The line of code that is having an issue, is
Column( colNamesList[theColumn] || " PASS/Fail" ) << delete formula;
The error statement is saying that it can not find the column that is being referenced. The column being referenced should have been created in the statement just before.
dt << New Column( colNamesList[theColumn] || " PASS/Fail", numeric, CONTINUOUS, FORMULA( If( __LSL__ <= __col__ <= __USL__, 1, 0 ) ) );
What is required for this statement to work, is that both an LSL and a USL exist for the column being referenced in the formula. I suspect this is the issue. I would check to make sure that both LSL and USL exist.
Concerning your question
"Also why do we use "__" in specs limits like LSL"
This is not a JMP requirement. In the Substitute() function, there is a requirement to have pairs of matching values that JMP is going to use for the substitution. I use the "__" before and after the matching values, just to make the code clear. I also give the name of the matching pair something meaningful. And in this case, the Substitution() function is substituting the LSL, the reference Col and the USL, and so by my convention, I use, __LSL__, __col__ and __USL__.
I did that check and made sure that LSL and USL both should be there in specs table. In fact, I also start the For loop -- the Column = 10 where I knew that from column 10th onward, I have specs limits in the table, though it should be taken care by Is Empty statement.
The Manage Spec Limits, may not be finishing before the code below is processing. Try running just through the Manage Spec Limits. Then once it is complete, run the remaining code.
show(colNamesList[theColumn] || " PASS/Fail");
Just before line 19
Then take a look at what name the code is complaining about
Hi, Yes it is working if I am running code till manage spec limit first and then the rest of it, And adding
show(colNamesList[theColumn] || " PASS/Fail"); does not make any difference. Code is still not running in one go, even after adding this line.
Is there any way I can force to evaluate manage specs limit part first and then move further or can I put some wait (say - 2 sec) commend before going into the for loop ?
You can add a
dt << rerun formulas;
dt << rerun formulas; and wait (0) - none of them is working for me. But yes, if I split my code in two runs -- it is working fine.
Any other suggestion ?
Whatever the wait time I am putting, it just evaluate only first column and through the same error. But, if I split and run it in two parts -- it is fine ! No idea why ?
In the script, if I comment out --
Column( colNamesList[theColumn] || " PASS/Fail" ) << delete formula; it is running fine.
Just a query -- are we not deleting the column formula, even before we are getting our column? As our column will be complete
once we will substitute the values of LSL and USL and we are doing in in the next line of For loop ?
colNamesList = dt << get column names(string,continuous); For( theColumn = 1, theColumn <= N Items( colNamesList ), theColumn++, Clear Symbols( specs ); specs = Column( dt, colNamesList[theColumn] ) << get property( "Spec Limits" ); If( Is Empty( specs ) == 0, /*show(colNamesList[theColumn] || " PASS/Fail"), Wait (1); */ Eval( Substitute( Expr( dt << New Column( colNamesList[theColumn] || " PASS/Fail", numeric, CONTINUOUS, FORMULA( If( __LSL__ <= __col__ <= __USL__, 1, 0 ) ) ); /* Column( colNamesList[theColumn] || " PASS/Fail" ) << delete formula;*/ ), Expr( __LSL__ ), specs["LSL"], Expr( __col__ ), Parse(":" || colNamesLIst[theColumn] ), Expr( __USL__ ), specs["USL"] ) ) ); );
There are no labels assigned to this post.