Tutorial
Using Formulas in Rules


Top     Installation     Introduction     Samples     Tutorial     Reference     Release Notes


You can add formulas in rules. To get PriceRules to calculate the actual price, add this rule to the rule set:

Price = Quantity * UnitPrice

You can also add a number of other quantities to be priced. The spreadsheet now looks like:

Change the quantities to see different prices, or change the discount quantity to recalculate at the new breakpoint.

Asking the User

A rule set can have an interactive dialog with the user, asking for values when needed. To set up a property to query the user, make a rule like this:

quantity = ASK( "What is the quantity ordered? " )

When the rule set needs a value for quantity it will put up a dialog box asking the user for the value.

This technique is useful for rule sets that only use a portion of the input facts on any one case. The rule set will only ask for the value when the fact is being considered in a rule condition. So facts that aren't actually needed for a particular case are not asked.

Document Assembly

Text formulas can be used in rules as well, allowing for document assembly. The spreadsheet below illustrates the basic idea.

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.