Implementing a Rule by a Macro
The macro is written in VBScript and uses HOPEX APIs.
To define a macro implementing a rule:
1. Right-click the rule.
2. Select New > Implementing Macro.
A macro is created and functions to be implemented are automatically declared.
The following is the detail of these functions:
Sub RuleAppliableIs (oToBeRuled as MegaObject, oRule as MegaObject, sParameter as String, bRuleAppliableIs as Boolean)
Sub RuleApply (oToBeRuled as MegaObject, oRule as MegaObject, sParameter as String, bRuleResult as Boolean)
*"oRule" is the modeling rule implemented.
The RuleAppliableIs function returns "true" in the "bRuleAppliableIs" variable if "oToBeRuled" is a root project. If not, it returns "false".
The RuleApply function returns "true" in the "bRuleResult" variable if "oToBeRuled" is connected to a project type.
The "RuleAppliableIs" function is optional. If it is not defined, the rule is implicitly applicable to all instances of the MetaClass (which is the case for the majority of rules).
 
Another function can be implemented if we wish to control the content of text inserted in the detailed report when the rule is not verified:
Sub RuleWithReportApply (oToBeRuled, oRule, sParameters, bRuleResult, sErrorReport)
This function is called on building the detailed report. The last parameter enables sending of a precise error report adapted to the processing carried out.