Macro: CONSTRAIN

Module location: FMAC line 8551 (view source)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Command: VCONSTRAIN fileNum RELATES fileNum2 VCONSTRAIN fileNum AS boolExpression VCONSTRAIN fileNum fieldNum mode expression VCONSTRAIN fileNum fieldNum mode fileNum2 fieldNum2 Description: This command allows a variable constraint to be created. Parameters: fileNum Num of the file to be constrained fieldNum Num of the field to be constrained boolExpression An expression which is treated as FALSE if it evaluates to zero, TRUE if non-zero expression Any DataFlex expression fileNum2 Num of the file to be constrained to fieldNum2 Num of the field to be constrained to mode Either the symbols LT, LE, EQ, NE, GT, GE, CONTAINS, and MATCHES, or an expression that corresponds to their symbolic value. MATCHES = 6, CONTAINS = 7. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

  #IFSAME !2 AS
    #CHECK !3 _CFLVNSWG#
    #CHECK !1.FILE_NUMBER _R#ULWV
    #SET Q$ !1.FILE_NUMBER
    !A [] $DB |CI!q !3        // FILE AS (BOOL-EXP)
  #ELSE
    #IFSAME !2 BETWEEN      // FIELD BETWEEN A AND B
      #CHECK !4 "AND"
      CONSTRAIN !1 GE !3
      CONSTRAIN !1 LE !5
    #ELSE
      #IFSAME !2 RELATES
        #CHECK !3 "TO"
        #IFDEF !1
          #IFDEF !4
            !A [] $D9 !1 !4        // FILE RELATES TO FILE
          #ELSE
            !A [] $D9 !1 !4.FILE_NUMBER // FILE RELATES TO FILE
          #ENDIF
        #ELSE
          #IFDEF !4
            !A [] $D9 !1.FILE_NUMBER !4
          #ELSE
            !A [] $D9 !1.FILE_NUMBER !4.FILE_NUMBER
          #ENDIF
        #ENDIF
      #ELSE
        #CHECK !1 _R#LWVCEBG
        #IF !0>1
          #IFSAME !2 MATCHES
            #SET Q$ 6
          #ELSE
            #IFSAME !2 CONTAINS
              #SET Q$ 7
            #ELSE
              #CHECK !2 _U
              #SET Q$ !2
            #ENDIF
          #ENDIF
          MOVE |CI!q TO INDEX_NUMBER
          #IFCLASS !3 "F"
            !A [] $D2 !1 !3 // FILE MODE FILE
          #ELSE
            !A [] $D1 !1 !3 // FILE MODE VALUE
          #ENDIF
        #ELSE
          #CHECK !1 _CVW#GRE
          !A [] $D3 !1 // FIELD ONLY
        #ENDIF
      #ENDIF
    #ENDIF
  #ENDIF