hexagon logo

Affirming a unique value is input

Ok, so this seems so simple, but i'm spinning my wheels here trying to figure it out.

I have a 4 cavity fixture.  Routine allows for 1-4 parts to be loaded, starting at fixture position 1 onward. 
Normally, dimensional data gets spit out relative to fixture position (POS) with traceability elements to Measurlink: IE: Part 1 = POS1 Dim A, Dim B, Dim C, Part 2 = POS2 Dim A, Dim B, Dim C, etc thru POS4.

What we need, to keep a new capability requirement valid, is when a part gets remeasured (<4 parts in the fixture), we need to define which position the measured data will be populated into, within Measurlink

In addition, in epic Measurlink fashion, you cannot define more than one observation's POS value with multiple data points.  So I need to do a validation loop to make sure the input value is unique. IE you can't have POS 2, POS 2, POS 3, I have to make sure there will never be an instance of a redundant "2" being populated.

I have "or" "and" lined up and functioning for ensuring fixture position 1 and 2 are unique, but my AND inputs are not affirming unique entry between fixture positions 2 and 3.  Tried using Array to sample two at once and that didn't work either.

Anyone have a different strategy that can affirm IF POSITION_1, POSITION_2 AND/OR POSITION_3 all have a unique whole integer between 1 and 4?

POSITION2 if statement works rock solid.  I just need to figure out how to assess one more possibility with POSITION3's validation IF statement.

Here's my code:

QTYQUESTION=LABEL/
QTY        =COMMENT/INPUT,NO,FULL SCREEN=YES,
            How many parts will you      
            load onto the fixture?
            IF/QTY.INPUT-INT(QTY.INPUT)<>0 OR !(QTY.INPUT>=1 AND QTY.INPUT<=4)
              COMMENT/OPER,NO,FULL SCREEN=YES,AUTO-CONTINUE=NO,
              Invalid input! Please input 
              a value between 1 and 4.
            GOTO/QTYQUESTION
            END_IF/
LOTNUMLOOP =LABEL/
LOT_NUM    =COMMENT/INPUT,NO,FULL SCREEN=YES,
            'Lot#?'
            IF/UPPERCASE(LOT_NUM.INPUT=="LOT")
              COMMENT/OPER,NO,FULL SCREEN=YES,AUTO-CONTINUE=NO,
              Please input a valid
              lot number!
            GOTO/LOTNUMLOOP
            END_IF/
CAVPROMPT  =LABEL/
            ASSIGN/CAVNUM=1
CAV_1      =COMMENT/INPUT,NO,FULL SCREEN=YES,
            'What cavity is in
            station 1?'
            ASSIGN/CAVITY=ARRAY(UPPERCASE(CAV_1.INPUT))
            ASSIGN/CAVID=ARRAY(UPPERCASE(LEFT(CAV_1.INPUT,1)))
            IF/QTY.INPUT<4
POS1QUESTION  =LABEL/
POSITION_1   =COMMENT/INPUT,NO,FULL SCREEN=YES,
              What Measurlink Position should 
              fixture station 1 be output to?
              IF/POSITION_1.INPUT-INT(POSITION_1.INPUT)<>0 OR !(POSITION_1.INPUT>=1 AND POSITION_1.INPUT<=4)
                COMMENT/OPER,NO,FULL SCREEN=YES,AUTO-CONTINUE=NO,
                Invalid input! Please input 
                a value between 1 and 4.
              GOTO/POS1QUESTION
            END_IF/
            END_IF/
            ASSIGN/POSARRAY[1]=POSITION_1.INPUT
            IF_GOTO/QTY.INPUT==1,GOTO = QTYSKIP1
CAV_2      =COMMENT/INPUT,NO,FULL SCREEN=YES,
            'What cavity is in
            station 2?'
            ASSIGN/CAVNUM=CAVNUM+1
            ASSIGN/CAVITY[LEN(CAVITY)+1]=UPPERCASE(CAV_2.INPUT)
            ASSIGN/CAVID[LEN(CAVID)+1]=UPPERCASE(LEFT(CAV_2.INPUT,1))
            IF_GOTO/!(LEFT(CAVITY[2],1)==CAVID[1]),GOTO = CAV_FAIL
            IF/QTY.INPUT<4
POS2QUESTION  =LABEL/
POSITION_2   =COMMENT/INPUT,NO,FULL SCREEN=YES,
              What Measurlink Position should 
              fixture station 2 be output to?
              IF/POSITION_2.INPUT-INT(POSITION_2.INPUT)<>0 OR (!(POSITION_2.INPUT>=1 AND POSITION_2.INPUT<=4) AND !(POSITION_2.INPUT==POSARRAY[1]))
                COMMENT/OPER,NO,FULL SCREEN=YES,AUTO-CONTINUE=NO,
                Invalid input! Please input a  .
                UNIQUE value between 1 & 4.
              GOTO/POS2QUESTION
            END_IF/
            END_IF/
            ASSIGN/POSARRAY[2]=POSITION_2.INPUT
            IF_GOTO/QTY.INPUT==2,GOTO = QTYSKIP1
CAV_3      =COMMENT/INPUT,NO,FULL SCREEN=YES,
            'What cavity is in
            station 3?'
            ASSIGN/CAVNUM=CAVNUM+1
            ASSIGN/CAVITY[LEN(CAVITY)+1]=UPPERCASE(CAV_3.INPUT)
            ASSIGN/CAVID[LEN(CAVID)+1]=UPPERCASE(LEFT(CAV_3.INPUT,1))
            IF_GOTO/!(LEFT(CAVITY[3],1)==CAVID[1]),GOTO = CAV_FAIL
            IF/QTY.INPUT<4
POS3QUESTION  =LABEL/
POSITION_3   =COMMENT/INPUT,NO,FULL SCREEN=YES,
              What Measurlink Position should 
              fixture station 3 be output to?
              IF/POSITION_3.INPUT-INT(POSITION_3.INPUT)<>0 OR ((!(POSITION_3.INPUT>=1 AND POSITION_3.INPUT<=4) AND (!(POSITION_3.INPUT==POSARRAY[1]))) AND (!(POSITION_3.INPUT==POSARRAY[2])))
                COMMENT/OPER,NO,FULL SCREEN=YES,AUTO-CONTINUE=NO,
                Invalid input! Please input a  .
                UNIQUE value between 1 & 4.
              GOTO/POS3QUESTION
            END_IF/
            END_IF/
            IF_GOTO/QTY.INPUT==3,GOTO = QTYSKIP1
CAV_4      =COMMENT/INPUT,NO,FULL SCREEN=YES,
            'What cavity is in 
            station 4?'
            ASSIGN/CAVNUM=CAVNUM+1
            ASSIGN/CAVITY[LEN(CAVITY)+1]=UPPERCASE(CAV_4.INPUT)
            ASSIGN/CAVID[LEN(CAVID)+1]=UPPERCASE(LEFT(CAV_4.INPUT,1))
            IF_GOTO/!(LEFT(CAVITY[4],1)==CAVID[1]),GOTO = CAV_FAIL
            IF_GOTO/QTY.INPUT==4,GOTO = QTYSKIP1
CAV_FAIL   =LABEL/
            COMMENT/OPER,NO,FULL SCREEN=YES,AUTO-CONTINUE=NO,
            "Mold ID for " +CAVNUM+ "doesn't match POS1"
            "Please correct the error."
            "(click ok to return to POS1 prompt)"
            GOTO/CAVPROMPT
QTYSKIP1   =LABEL/



correct typo, bold main question
[edited by: louisd at 8:43 PM (GMT -5) on Jun 17, 2025]
  • Note, yes, i've been trying to get barcoded sample labels to be produced with our ERP software for two years now... that will eliminate a majority of these validation loops, but until then i'm stuck doing this to sustain FDA GDP (Good Documentation Practice)

  • This sounds good in my head, and it may not what you are asking for or even work for what you are doing. Since this is not directly related to the INPUT validation. Could you reliably control positions based on the X, Y or Z value of the part being measured? And then automatically know that the part is in POSITION_1, 2, 3, 4 etc. That is of course if POSITION_1 is always starting within the same X, Y, or Z value range due to you using a Fixture for part positions.

  • What you have is super complicated to the point I'd be willing to bet there is an edge case that totally breaks everything. This really is on the level of a leetcode easy. My solution could be better but this shows the idea

    for i = 1 to number_of_values - 1
        for j = i + 1 to number_of_values
    
            value_to_check = list(i)
            value_to_compare = list(j)
            is_unique = value_to_check <> value_to_compare
       
    
            if not is_unique then exit for 
       
        next j
        if not is_unique then exit for
    next i