Assigning Variables

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

  • Assigning Variables

    I've searched through some of the archives and still can't get this down right. I'm asking the operator to enter the fixture letter of the part that they are inspecting. There are 2 letters per machine. I have them check 4 machines at one time. At the beginning of the program I ask them to enter the fixture letter and the machine number for each part on the CMM. I would like to eliminate having them put in the machine number by assigning a variable that would figure out which machine number is associated with the fixture letter entered. I need to be able to sort by fixture letter or machine number within our data collection software so I need to be able to put this in a tracefield. Here is an example of what I am trying to do:

    C1 =COMMENT/INPUT,NO,'Enter the Fixture Letter : '
    ASSIGN/V1 = C1.INPUT
    IF/V1=="A" OR "a" OR "B" OR "b"
    ASSIGN/V1 = 1
    END_IF/
    IF/V1=="C" OR "c" OR "D" OR "d"
    ASSIGN/V1 = 2
    END_IF/
    COMMENT/REPT,V1


    Obviously this isn't working and gives me 2 everytime. I will also be doing this for a Comment C2,C3, & C4 checking for upper and lower case entries for 8 different letters. Any suggestions? It seems so simple - I think I might just be over-thinking on this one. TIA
    sigpic

  • #2
    I think a select case might be nice for this then you could put an else block at the end in case an operator enters nul or junk.

    It may not be working because or your or statement (I think)

    you do:
    Code:
    C1 =COMMENT/INPUT,NO,'Enter the Fixture Letter : '
    ASSIGN/V1 = C1.INPUT
    IF/V1=="A" OR "a" OR "B" OR "b"
    ASSIGN/V1 = 1
    END_IF/
    IF/V1=="C" OR "c" OR "D" OR "d"
    ASSIGN/V1 = 2
    END_IF/
    COMMENT/REPT,V1
    I think you need:
    Code:
    C1 =COMMENT/INPUT,NO,'Enter the Fixture Letter : '
    ASSIGN/V1 = C1.INPUT
    IF/V1=="A" OR V1== "a" OR V1== "B" OR V1== "b"
    ........
    ........
    ........
    ........
    ........
    ........
    Try select case though


    Craig
    Last edited by craiger_ny; 07-27-2006, 03:13 PM.
    <internet bumper sticker goes here>

    Comment


    • #3
      I have a small script that I use that pops a box up and asks what Impression
      number it would be easy to fix it to your needs if you would like to take a look at it pm with your email addy
      sigpic
      if you had soap on a rope it would be tied to yer ankle

      Comment


      • #4
        I see another problem with your variable assignment. You need to use a different variable when one of your conditions are met. If your first condition is met then you assign V1 then turn around and evaluate V1.

        Try assigning V2 when one of the conditions is met because V1 is the variable you are testing.
        Code:
        C1         =COMMENT/INPUT,NO,"ENTER THE FIXTURE LETTER"
                    ASSIGN/V1 = C1.INPUT
                    IF/V1 == "a" OR V1 == "A" OR V1 == "b" OR V1 == "B"
                    ASSIGN/V2 = 1
                    END_IF/
                    IF/V1 == "c" OR V1 == "C" OR V1 == "d" OR V1 == "D"
                    ASSIGN/V2 = 2
                    END_IF/
        I still think you should put an else statement in to be safe. Not mandatory just my opinion.

        Craig
        Last edited by craiger_ny; 07-27-2006, 03:27 PM.
        <internet bumper sticker goes here>

        Comment


        • #5
          This works - Partially

          C1 =COMMENT/INPUT,NO,'Enter a Letter A or B : '
          IF/C1.INPUT=="A" OR "a" OR "B" OR "b"
          COMMENT/REPT,1
          END_IF/
          IF/C1.INPUT=="C" OR "c" OR "D" OR "d"
          COMMENT/REPT,2
          END_IF/
          IF/C1.INPUT=="E" OR "e" OR "F" OR "f"
          COMMENT/REPT,3
          END_IF/
          IF/C1.INPUT=="G" OR "g" OR "H" OR "h"
          COMMENT/REPT,4
          END_IF/


          I can get this to give the correct number no matter what case I use. If the comments would just give me C2,C3,C4, etc... I'd be OK and I can get what I want out of it - None of the comment selections other than INPUT will give me this to use for a variable.
          sigpic

          Comment


          • #6
            Originally posted by djayne
            [
            I can get this to give the correct number no matter what case I use. If the comments would just give me C2,C3,C4, etc... I'd be OK and I can get what I want out of it - None of the comment selections other than INPUT will give me this to use for a variable.
            I think he meant to use the select case flow control pair not caps or lowercase?

            .02

            TK
            sigpicHave a homebrew

            Comment


            • #7
              I guess I'm not following the problem well here. Sorry.

              Craig
              <internet bumper sticker goes here>

              Comment

              Related Topics

              Collapse

              Working...
              X