Skip to main content


persistent class Ens.Rule.Rule extends %Library.Persistent, %XML.Adaptor

SQL Table Name: Ens_Rule.Rule

Defines a Business Rule within a Rule set.

Property Inventory

Method Inventory


parameter XMLIGNORENULL = 1;
Ensure that we don't get $C(0) for values that are empty strings


relationship Actions as array of Action (XMLNAME = "action", XMLPROJECTION = "ELEMENT") [ InitialExpression = $listbuild("Ens.Rule.Action","Rule",+$this,"children",1,1) , Transient , Inverse = Rule , Cardinality = children ];
Collection of optional actions associated with this Rule.
Property methods: ActionsGet(), ActionsGetObject(), ActionsGetObjectId(), ActionsGetSwizzled(), ActionsIsEmpty(), ActionsIsValid(), ActionsNewObject(), ActionsRClose(), ActionsRExec(), ActionsRFetch(), ActionsRelate(), ActionsSQLCompute(), ActionsSet(), ActionsUnRelate()
relationship Conditions as array of Condition (XMLNAME = "condition", XMLPROJECTION = "ELEMENT") [ InitialExpression = $listbuild("Ens.Rule.Condition","Rule",+$this,"children",1,1) , Transient , Inverse = Rule , Cardinality = children ];
Collection of conditions that define this Rule.
Property methods: ConditionsGet(), ConditionsGetObject(), ConditionsGetObjectId(), ConditionsGetSwizzled(), ConditionsIsEmpty(), ConditionsIsValid(), ConditionsNewObject(), ConditionsRClose(), ConditionsRExec(), ConditionsRFetch(), ConditionsRelate(), ConditionsSQLCompute(), ConditionsSet(), ConditionsUnRelate()
property Disabled as %Boolean (XMLNAME = "disabled", XMLPROJECTION = "ATTRIBUTE");
If false, then this rule is enabled; otherwise this rule is not evaluated.
Property methods: DisabledDisplayToLogical(), DisabledGet(), DisabledGetStored(), DisabledIsValid(), DisabledLogicalToDisplay(), DisabledLogicalToXSD(), DisabledNormalize(), DisabledSet(), DisabledXSDToLogical()
property ReturnValue as %String (MAXLEN = 128, XMLNAME = "return", XMLPROJECTION = "ATTRIBUTE");
If defined, value returned if this Rule is true.
Property methods: ReturnValueDisplayToLogical(), ReturnValueGet(), ReturnValueGetStored(), ReturnValueIsValid(), ReturnValueLogicalToDisplay(), ReturnValueLogicalToOdbc(), ReturnValueNormalize(), ReturnValueSet()
property RuleNo as %Integer (XMLPROJECTION = "NONE") [ InitialExpression = $I(^Ens.Rule.RuleC("RuleNo")) , Required ];
Property methods: RuleNoDisplayToLogical(), RuleNoGet(), RuleNoGetStored(), RuleNoIsValid(), RuleNoLogicalToDisplay(), RuleNoNormalize(), RuleNoSet(), RuleNoXSDToLogical()
relationship RuleSet as Ens.Rule.RuleSet [ Required , Inverse = Rules , Cardinality = parent ];
Parent RuleSet.
Property methods: RuleSetGet(), RuleSetGetObject(), RuleSetGetObjectId(), RuleSetGetStored(), RuleSetGetSwizzled(), RuleSetIsValid(), RuleSetNewObject(), RuleSetOnDelete(), RuleSetRClose(), RuleSetRExec(), RuleSetRFetch(), RuleSetRelate(), RuleSetSQLCompute(), RuleSetSet(), RuleSetSetObject(), RuleSetSetObjectId(), RuleSetUnRelate(), RuleSetUnSwizzle()
property SubRules as list of SubRule (XMLNAME = "rule", XMLPROJECTION = "ELEMENT");
Collection of SubRules of this Rule.
Property methods: SubRulesBuildValueArray(), SubRulesCollectionToDisplay(), SubRulesCollectionToOdbc(), SubRulesDisplayToCollection(), SubRulesGet(), SubRulesGetObject(), SubRulesGetObjectId(), SubRulesGetStored(), SubRulesGetSwizzled(), SubRulesIsValid(), SubRulesOdbcToCollection(), SubRulesSet(), SubRulesSetObject(), SubRulesSetObjectId()


classmethod %OnDelete(oid As %ObjectIdentity) as %Status
This callback method is invoked by the %Delete() method to provide notification that the object specified by oid is being deleted.

If this method returns an error then the object will not be deleted.

method Evaluate(pRuleSet As RuleDefinition, pRuleNo As %Integer, pContext As %RegisteredObject, Output pValue As %Boolean, Output pErrorMsg As %String) as %Status
Evaluate this Rule.
Returns user errors via pErrorMsg.
method GenerateCode(pCompiler As Compiler, pRuleNo As %Integer) as %Status
Generate code for this Rule.
pRuleNo gives the ordinal position of this Rule within the Rule Set.


index (ID on RuleNo) [IdKey, Type = key];
Make sure rules are ordered correctly
Index methods: IDCheck(), IDDelete(), IDExists(), IDOpen(), IDSQLCheckUnique(), IDSQLExists(), IDSQLFindPKeyByConstraint(), IDSQLFindRowIDByConstraint()

Inherited Members

Inherited Methods


Storage Model: CacheStorage (Ens.Rule.Rule)

FeedbackOpens in a new tab