hexagon logo

Testing Operator input for special characters or wild cards

Anyone have an idea how to test and stop operators inputting \/:*?<>| in comments? If it contains those then it will comment back and tell them to try again? im trying to use an if_goto statements.

[C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
ENTER SERIAL NUMBER
ASSIGN/NEWSN=C1.INPUT
IF_GOTO/NEWSN=="/" ,GOTO = DEATH
IF_GOTO/NEWSN==":" ,GOTO = DEATH
IF_GOTO/NEWSN=="*" ,GOTO = DEATH
IF_GOTO/NEWSN=="?" ,GOTO = DEATH
IF_GOTO/NEWSN=="<" ,GOTO = DEATH
IF_GOTO/NEWSN==">" ,GOTO = DEATH
IF_GOTO/NEWSN=="|" ,GOTO = DEATH
IF_GOTO/NEWSN=="0" ,GOTO = DEATH
GOTO/LIVE
DEATH =LABEL/
IF/1
COMMENT/OPER,NO,FULL SCREEN=YES,AUTO-CONTINUE=YES,TIME DELAY=10,
DO NOT USE SPECIAL CHARACTERS FOR THE INPUT.
TRY AGAIN!
GOTO/C1
END_IF/
LIVE =LABEL/​]
Parents
  • What does your input HAVE to be?

    If your serial number comment is ALWAYS a numeric integer (whole number)
    LABEL/SNQUESTION
    C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
    ENTER SERIAL NUMBER

    IF/C1.INPUT-INT(C1.INPUT)<>0
    COMMENT/OPER,NO,FULL SCREEN=YES,AUTO-CONTINUE=NO,
    Invalid input! Please input
    a serial number with
    only numerical digits
    GOTO/SNQUESTION
    END_IF/​

    If your serial number is ALWAYS a certain length, you can also force the Comment to be a LEN() value.

    Also there's a couple very powerful functions in PCDMIS,
    --the NOT modifier (!)
    --ASCII values CHR() Example: you can create an array of ASCII Values that you want to prohibit then assess the comment as a string to affirm it does NOT have the any of the array characters

    assign\forbidden=Array(CHR(47),CHR(46),CHR(42),CHR (63),CHR(60),CHR(62),CH R(124),CHR(48),CHR(32))
    that FORBIDDEN is your IF_GOTO series of values in an array, plus 32 is the spacebar, which i'm also guessing you don't want.
    with that array, you can do an IF with a do/until all characters in the string are judged.

    --I don't think you can blindly query if the entire input contains any of those characters, by the means in which you were with the IF_GOTO's you posted.
    --or are you trying to prevent the operators from inputting just those characters as a means to bypass the serial number?​

    Another idea would be to implement a barcode scanner and make production give a 3of9 barcode font (it's a free font to download anywhere) barcode to the serialized components. that way, it's impossible to fubar the serial number entry, unless the label was made wrong.
Reply
  • What does your input HAVE to be?

    If your serial number comment is ALWAYS a numeric integer (whole number)
    LABEL/SNQUESTION
    C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
    ENTER SERIAL NUMBER

    IF/C1.INPUT-INT(C1.INPUT)<>0
    COMMENT/OPER,NO,FULL SCREEN=YES,AUTO-CONTINUE=NO,
    Invalid input! Please input
    a serial number with
    only numerical digits
    GOTO/SNQUESTION
    END_IF/​

    If your serial number is ALWAYS a certain length, you can also force the Comment to be a LEN() value.

    Also there's a couple very powerful functions in PCDMIS,
    --the NOT modifier (!)
    --ASCII values CHR() Example: you can create an array of ASCII Values that you want to prohibit then assess the comment as a string to affirm it does NOT have the any of the array characters

    assign\forbidden=Array(CHR(47),CHR(46),CHR(42),CHR (63),CHR(60),CHR(62),CH R(124),CHR(48),CHR(32))
    that FORBIDDEN is your IF_GOTO series of values in an array, plus 32 is the spacebar, which i'm also guessing you don't want.
    with that array, you can do an IF with a do/until all characters in the string are judged.

    --I don't think you can blindly query if the entire input contains any of those characters, by the means in which you were with the IF_GOTO's you posted.
    --or are you trying to prevent the operators from inputting just those characters as a means to bypass the serial number?​

    Another idea would be to implement a barcode scanner and make production give a 3of9 barcode font (it's a free font to download anywhere) barcode to the serialized components. that way, it's impossible to fubar the serial number entry, unless the label was made wrong.
Children
No Data