hexagon logo

Testing commend input for numbers

Hello, I'm rather new to using logical operations in PCDMIS, so please bear with me.

I have a dialog box pop up when starting my program to ask the operator what fixture number the part came from. This can be 1 - 48. I am passing this number through a Tracefield to Excel output to WinSPC. I cannot handle this Fixture_Number variable in anything else but a strict numerical input like "23" when WinSPC is processing this data. How can I test if this input is strictly a number between 1 & 48, with no other characters? I think I'd be ok if it was just a number test, but would be nice if it also caught numbers that are more than 2 digits. Any ideas?

Snippet:


Thanks
Parents
  • Cris_C, Thanks! That worked well. Now to complicate matters, I want to make sure that the numbers entered are integers... This is my attempt, but it's not working...

    {"alt":"Click image for larger version Name:\timage.png Views:\t7 Size:\t5.4 KB ID:\t518919","data-align":"none","data-attachmentid":"518919","data-size":"full","title":"image.png"}

    Any thoughts?


    The INT() function will turn the input into an integer. So, you can adjust your assignment to be:
    ASSIGN/FIXTURE_NUMBER=INT(C2.INPUT)

    INT(“12”)=12
    INT(“Cat”)=0
    INT(“$52”)=0
    INT(“22B123”)=22
    INT(“13.6234”)=13

    Notice how anything that does not start with a number will equal Zero. That works well as zero will cause the first IF statement to be true and prompt the user to try again. The second IF statement becomes unnecessary.
Reply
  • Cris_C, Thanks! That worked well. Now to complicate matters, I want to make sure that the numbers entered are integers... This is my attempt, but it's not working...

    {"alt":"Click image for larger version Name:\timage.png Views:\t7 Size:\t5.4 KB ID:\t518919","data-align":"none","data-attachmentid":"518919","data-size":"full","title":"image.png"}

    Any thoughts?


    The INT() function will turn the input into an integer. So, you can adjust your assignment to be:
    ASSIGN/FIXTURE_NUMBER=INT(C2.INPUT)

    INT(“12”)=12
    INT(“Cat”)=0
    INT(“$52”)=0
    INT(“22B123”)=22
    INT(“13.6234”)=13

    Notice how anything that does not start with a number will equal Zero. That works well as zero will cause the first IF statement to be true and prompt the user to try again. The second IF statement becomes unnecessary.
Children
No Data