Reference


Top     Installation     Introduction     Samples     Tutorial     Reference     Release Notes


Multiple Rule Sets and Inheritance

More complex applications often require multiple interrelated rule sets. Multiple rule sets require two types of relationships:

See Techniques Advanced.xls for an example.

Logical Relationships

One rule set can reference facts in another rule set using this syntax:

RuleSetName:Fact

For example:

UnitPrice = Gizmo:UnitPrice when Part = "Gizmo"

In this case the UnitPrice is calculated in the Gizmo rule set when Part = "Gizmo".

A rule set can also inherit rules from other rule sets. This is done using the INHERIT FROM command. For example if a specific Part rule set for Widgets inherited from a general Part rule set and also a Thing rule set the following rule would implement that logical dependency:

Inherit from Part Thing

Excel Dependency

If there are multiple rule sets, Excel needs to know which rule sets are dependent upon others just like it needs to know what cell calculations are dependent on other cells. This is needed when any of the rule sets change, the queries dependent on them are recalculated.

This is done by including the function RXLDependency(...) in a main rule set. For example, if the main rule set is PriceRules and it uses the rule sets: Thing, Part, Widget, and Gizmo, then this function can be added to PriceRules to capture that dependency:

=RXLDependency(Thing, Part, Widget, Gizmo)

Note that this ensures that all of the needed rule sets are updated, and that Excel maintains the appropriate dependency links, but does not imply any logical relationship. That is done with the explicit names (ruleset:fact) and the Inherit rule above.

Inheritance

A rule set can be a subclass of other rule sets, meaning that it can get properties from its super class when those facts are not defined in the rule set. The syntax is:

INHERIT FROM superclass_1 superclass_2 ...

Example:

INHERIT FROM PartRules PriceRules

Previous

Next

Open in New Window to Print


Copyright ©2005-7 Amzi! inc. All Rights Reserved.
ARulesXL and Amzi! are trademarks or registered trademarks of Amzi!
Microsoft and Excel are trademarks or registered trademarks of Microsoft Corporation.