RuleIsBroken (test rule and return result)

Top  Previous  Next

 

RuleIsBroken( display )

RuleIsBroken

Tests the rule and returns the result

Display

An integer constant, variable, EQUATE, or expression that indicates whether to display an error indicator if the rule is broken.

The RuleIsBroken method uses EVALUATE to test SELF.Expression. If the result is zero, the rule is considered broken. Otherwise, the rule is considered sound. The method returns True if the rule is broken, False if not. If the value of display is non-zero, an error indicator is set using the SetIndicator method.

Implementation:

The RuleIsBroken method relies on the EVALUATE function to test a string containing an expression. Accordingly, all names used in the expression must be bound. If a procedure name is used, it must return a STRING, REAL or LONG value. If the procedures accept parameters, those paramaters must be STRINGs passed by value and may not be omittable.

The RuleIsBroken method tests explicitly for errors related to the EVALUATE process and ignores errors which might be posted by called procedures. These procedures must therefore handle any errors which may be posted during their execution.

The RuleIsBroken method calls SELF.SetGlobalRule before evaluating the expression and SELF.ResetGlobalRule immediately after evaluating the expression. During the EVALUATE process, then, a called procedure can use the address posted to call back to the current Rule instance.

Return Data Type:     BYTE

Example:

RulesCollection.CheckAllRules Procedure(<BYTE DisplayIndicator>)

RetVal          LONG

LBR             &Rule

Counter         LONG

Recs            LONG

lIsBroken       BYTE

   CODE

   Recs    = SELF.RuleCount()

   Retval  = 0

   LOOP Counter = 1 TO Recs

      LBR    &= SELF.Item(Counter)

      lIsBroken= LBR.RuleIsBroken(DisplayIndicator)

      RetVal +=lIsBroken

   END

   IF SELF.ChangeControlsStatus

      SELF.SetControlsStatus()

   END

   RETURN(RetVal)

 

See Also: SetGlobalRule, ResetGlobalRule, SetIndicator