How do I force Operator Input to be correct format?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I force Operator Input to be correct format?

    Code:
    CS1        =SCRIPT/FILENAME= J:\CMM\REPORTING\SCRIPTS\ZERO.BAS
                FUNCTION/Main,SHOW=NO,,
                STARTSCRIPT/
                DO/
    C1         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                'Lot #:'
                UNTIL/C1.INPUT<>"0"
                DO/
    C6         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                Sequence #:
                UNTIL/C6.INPUT<>"0"
                DO/
    C2         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                'Serial #:'
                UNTIL/C2.INPUT<>"0"
                DO/
    C3         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                'Clock #:'
                UNTIL/C3.INPUT<>"0"
                TRACEFIELD/NO_DISPLAY,LIMIT=15 ; Lot # : C1.INPUT
                TRACEFIELD/NO_DISPLAY,LIMIT=15 ; Serial # : C2.INPUT
                TRACEFIELD/NO_DISPLAY,LIMIT=15 ; Inspector : C3.INPUT
                TRACEFIELD/NO_DISPLAY,LIMIT=15 ; Sequence # : C6.INPUT
                TRACEFIELD/NO_DISPLAY,LIMIT=30 ; DBSWITCH : "031937 D01 Calibration"
    In the code above where C1 the operator puts in Lot#, how would I go about making it so the operator would have to put in the Lot# in this format XXX-X-X for the program to continue. This is where the lot is a 3 digit # followed by a split and sub. When operator only puts in 3 digit number it causes grief in database reporting. Any help is appreciated!
    sigpicI won't be impressed with technology until I can download food.

  • #2
    You would have to check the entered string for the position of the "-" signs?
    Is it always 7 characters long?
    Are the "-" always in the same place?

    If it's only the length that worries you, just check the length of the operator input.
    Last edited by vpt.se; 06-28-2013, 01:03 PM.
    PC-DMIS CAD++ 2o19 R1 SP11

    Comment


    • #3
      CS1 =SCRIPT/FILENAME= J:\CMM\REPORTING\SCRIPTS\ZERO.BAS
      FUNCTION/Main,SHOW=NO,,
      STARTSCRIPT/
      DO/
      C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
      'Lot #:'
      UNTIL/C1.INPUT<>"0"
      DO/
      W4 =COMMENT/INPUT,NO,FULL SCREEN=NO,
      'split #:'
      UNTIL/C1.INPUT<>"0"
      DO/
      W5 =COMMENT/INPUT,NO,FULL SCREEN=NO,
      'Sub #:'
      UNTIL/C1.INPUT<>"0"
      DO/
      C6 =COMMENT/INPUT,NO,FULL SCREEN=NO,
      Sequence #:
      UNTIL/C6.INPUT<>"0"
      DO/
      C2 =COMMENT/INPUT,NO,FULL SCREEN=NO,
      'Serial #:'
      UNTIL/C2.INPUT<>"0"
      DO/
      C3 =COMMENT/INPUT,NO,FULL SCREEN=NO,
      'Clock #:'
      UNTIL/C3.INPUT<>"0"
      DO/
      ASSIGN/W7 = "" C1.input "-"+ W4.input + "-" + W5.input + ""
      TRACEFIELD/NO_DISPLAY,LIMIT=15 ; Lot # : W7
      TRACEFIELD/NO_DISPLAY,LIMIT=15 ; Serial # : C2.INPUT
      TRACEFIELD/NO_DISPLAY,LIMIT=15 ; Inspector : C3.INPUT
      TRACEFIELD/NO_DISPLAY,LIMIT=15 ; Sequence # : C6.INPUT
      TRACEFIELD/NO_DISPLAY,LIMIT=30 ; DBSWITCH : "031937 D01 Calibration
      Last edited by Lord_Warfield; 06-28-2013, 01:26 PM.

      Comment


      • #4
        They can still enter the wrong #'s but holds your format.

        Comment


        • #5
          ASSIGN/W7 = "" c1.input "-"+ c4.input + "-" + c5.input + ""

          Do you need to add the + ?
          ASSIGN/W7 = "" +c1.input +"-"+ c4.input + "-" + c5.input + ""

          B&S CHAMELEON/PCDMIS CAD++ V2011

          There are no bugs, only "UNDOCUMENTED ENHANCEMENTS!"

          sigpic

          Comment


          • #6
            I would use a VB script dialog box to make them input the Lot number into 3 separate fields, a 3-character wide and two 1-character wide.
            On the Dialog box, put text dashes between the fields so it looks right.
            Test their input for lengths 3, 1, 1
            Concatenate the inputs into a single string, adding the dashes between them as needed.
            I do not have time to work up an example, but see this post I made recently:
            http://www.pcdmisforum.com/showthrea...l=1#post356073

            Comment


            • #7
              Originally posted by dph51 View Post
              ASSIGN/W7 = "" c1.input "-"+ c4.input + "-" + c5.input + ""

              Do you need to add the + ?
              ASSIGN/W7 = "" +c1.input +"-"+ c4.input + "-" + c5.input + ""
              yup... need the + ...

              Comment


              • #8
                How would one go about testing for length of input?

                Comment


                • #9
                  Something like len(str)

                  B&S CHAMELEON/PCDMIS CAD++ V2011

                  There are no bugs, only "UNDOCUMENTED ENHANCEMENTS!"

                  sigpic

                  Comment


                  • #10
                    Originally posted by vpt.se View Post
                    You would have to check the entered string for the position of the "-" signs?
                    Is it always 7 characters long?
                    Are the "-" always in the same place?

                    If it's only the length that worries you, just check the length of the operator input.
                    Yes it's always 7 characters long...multiple ways as exampled here: 001-0-0, D03-3-0, 380-0-4, etc. etc.
                    The problem is not with the input of wrong numbers but the exclusion of the 2nd and 3rd parts of the equation.

                    ASSIGN/W7 = "" +c1.input +"-"+ c4.input + "-" + c5.input + ""
                    I will try this Lord_Warfield first. See how that goes! Thanks.

                    Also I would try the VB script dialog box but I'm not up to speed with the VB script yet! When and if I get some free time (doubtful here anytime soon!) I'll play around with that too. It looks very nice and I would eventually like to do that with our programs here..nice work Josh.
                    sigpicI won't be impressed with technology until I can download food.

                    Comment


                    • #11
                      http://www.pcdmisforum.com/showthrea...Input-Variable

                      Comment


                      • #12
                        Code:
                        CS1        =SCRIPT/FILENAME= J:\CMM\REPORTING\SCRIPTS\ZERO.BAS
                                    FUNCTION/Main,SHOW=NO,,
                                    STARTSCRIPT/
                                    DO/
                        C1         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                                    'Lot #:'
                                    UNTIL/C1.INPUT<>"0"
                                    DO/
                        C4         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                                    'Split #:'
                                    UNTIL/C4.INPUT<>"-1"
                                    DO/
                        C5         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                                    'Sub #:'
                                    UNTIL/C5.INPUT<>"-1"
                                    DO/
                        C6         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                                    Sequence #:
                                    UNTIL/C6.INPUT<>"0"
                                    DO/
                        C2         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                                    'Serial #:'
                                    UNTIL/C2.INPUT<>"0"
                                    DO/
                        C3         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                                    'Clock #:'
                                    UNTIL/C3.INPUT<>"0"
                                    ASSIGN/W1=""+C1.INPUT+"-"+C4.INPUT+"-"+C5.INPUT+"" 
                                    TRACEFIELD/NO_DISPLAY,LIMIT=15 ; Lot # : W1
                                    TRACEFIELD/NO_DISPLAY,LIMIT=15 ; Serial # : C2.INPUT
                                    TRACEFIELD/NO_DISPLAY,LIMIT=15 ; Inspector : C3.INPUT
                                    TRACEFIELD/NO_DISPLAY,LIMIT=15 ; Sequence # : C6.INPUT
                                    TRACEFIELD/NO_DISPLAY,LIMIT=30 ; DBSWITCH : "Part Number Seq "+C6.INPUT
                        This works okay..I will try the input-variable method to reduce number of "popups" for the operator (thanks again LW). They are already yelling at me for having to put too much information in!
                        sigpicI won't be impressed with technology until I can download food.

                        Comment


                        • #13
                          its better to have the operators yellin then management or process control.

                          Comment


                          • #14
                            ya think? lol, yes I agree with you.

                            I think the input-variable will be better..got it worked out and thanks again for the link. Will post code in case anyone following this thread is "curious".

                            Code:
                            TRY_AGAIN  =LABEL/
                            C1         =COMMENT/INPUT,NO,FULL SCREEN=NO,
                                        'Lot #:'
                                        ASSIGN/V1=C1.INPUT
                                        ASSIGN/V2=LEN(V1)
                                        IF/V2<>7
                                        COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                                        YOU HAVE ENTERED THE WRONG FORMAT FOR LOT NUMBER, 
                                        TRY AGAIN!
                                        GOTO/TRY_AGAIN
                                        END_IF/
                            Works like a charm.
                            sigpicI won't be impressed with technology until I can download food.

                            Comment

                            Related Topics

                            Collapse

                            Working...
                            X