[Jo...] Posted March 20 Share Posted March 20 Hey guys I am trying to write some PCM to update a tolerance depending on P/N. I have done this before but am not getting the expected output. MyPick=inquireList("Select Part #","CS_8S_20-40T_Op50","32654002","31825615","32651734","32651735") if MyPick=="CS_8S_20-40T_Op50" then RndTol11=="0.04" RndTol242=="0.03" else RndTol11=="1.8" RndTol424=="1.3" endif right now, I am getting an error "Parameter: then is not defined". I tried to remove the "Then" and when trying to display the variables I get an "a Zeiss.calypso.OMParameters" error. It has been a while since I dived into PCM. It is probably a simple syntax issue, as this is pretty basic. Appreciate the help. Link to comment Share on other sites More sharing options...
[Mi...] Posted March 20 Share Posted March 20 MyPick=inquireList("Select Part #","CS_8S_20-40T_Op50","32654002","31825615","32651734","32651735") if MyPick=="CS_8S_20-40T_Op50" then RndTol11="0.04" RndTol242="0.03" else RndTol11="1.8" RndTol424="1.3" endif change "==" to "=" when setting variables, "==" is used when comparing. Also, you probably want to remove the quotes on those tolerance values, quotes makes it a string, no-quotes would make it a number. Link to comment Share on other sites More sharing options...
[Jo...] Posted March 20 Author Share Posted March 20 That worked! I did have to just remove the "Then" as well. Thank you Please sign in to view this username. for the help. Link to comment Share on other sites More sharing options...
[Ri...] Posted March 24 Share Posted March 24 Also as an FYI I am not aware of any need for the use of the "then" statement inside of the "if" statement. I do see that it is a valid statement, so I'm not certain as to what the use cases are for when you would need it, maybe it's not inside of an "if" statement. Also also, you might want to look into using selectCase instead - mainly for the ability to have parameter files that you can easily update with variables instead of having them hard-coded into the measurement plan. Link to comment Share on other sites More sharing options...
[Jo...] Posted March 24 Author Share Posted March 24 Please sign in to view this quote. I got my programming/syntax mixed up when I was adding in the "Then" I believe. I have used parameter programming for a few applications. I remember programming 10-12 bearings on 1 program with different dimensions. It was a good application. This was just a one-off update. Link to comment Share on other sites More sharing options...
[Ke...] Posted March 24 Share Posted March 24 There is also the selectCase pcm, which can be very useful. It is especially useful for having multiple selections to avoid multiple "if then" or nested "if" statements, and it is also more flexible if you need to expand the options list in the future Example from the Calypso help menu selectCase number case is <= 0 Message = "Number is too small" case 1, 2, 3 Message = "Number is smaller than 4" case 4 to 7 Message = "Number is between 4 and 7" case is >8 AND number < 11 Message = "Number is 9 or 10" caseElse Message = "Number is outside the range" endSelect Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in