ARulesXL NewsletterIt's tax time in the U.S. and a new sample celebrates that time by showing how ARulesXL can be used to easily encode the rules for filling in a form. The sample uses the simple U.S. Tax Form 1040EZ form to illustrate a number of key points:
The application is designed with the rule sets next to the forms, which makes it easy to see how the two interact. That particular approach would also be a good one for developing this sort of application, allowing experts in the field to work with developers while creating and verifying the rules. When moving to production, however, it might make more sense to move the rule sets to their own worksheets in the application, leaving just the forms for the user to interact with.
The sample is called EZTax and is included as part of the new beta test release. (The sample will not run on earlier versions of ARulesXL.)
A new Beta Test release is available, 1-1-20-Beta. It features the new ARulesXL API (Application Programming Interface) that lets you query rulesets from a variety of web and stand-alone applications. The API will be a feature in the Professional Edition of ARulesXL that will be introduced at version 2.0.
It also adds the tax form sample (see above) a new function, EVALUATE, and documentation on a number of other functions added in previous beta releases.
EVALUATE() lets you call Excel functions from ARulesXL rules. It takes a string as an argument which has the expression to evaluate. This means you can dynamically create the function calls and arguments from within a rule set.
For example, in the new EZTax.XLS sample, the Excel function VLOOKUP is needed to find the tax from an Excel table named TaxTable. The lookup is based on the taxable income and whether the return is for a single person or a married couple filing jointly. The rules to find the tax value look like this:
.TaxTableColumn = 3 WHEN .FilingStatus = single
.TaxTableColumn = 4 WHEN .FilingStatus = joint
.Tax = EVALUATE( "VLOOKUP(" & .TaxableIncome & ", TaxTable," & .TaxTableColumn & ")" )
ARulesXL rule sets are developed and maintained in Microsoft Excel spreadsheets. The functions RCell() and RTable() can be used to get data from spreadsheet cells into rule sets, and RQuery() can be used outside a rule set to put computed rule set properties in spreadsheet cells, as well as provide input values for the rule set.
The rule sets developed under Excel can, of course, be easily deployed in Excel. But they can also be exported for deployment in other application contexts.
Two features make this possible:
The ARulesXL API includes functions that perform the same duties as RCell() & RTable() for making data available to a rule set, and RQuery() for getting results back from a rule set.
The ARulesXL API allows you to run rulesets in a variety of languages and tools. You load inputs from a variety of data sources (e.g. databases, users, networks), and query the ruleset to obtain results. You can display those results in your application's user interface or in Web pages. You can also use the results programmatically to create schedules, orders, analyses, recommendations and more.
The API is implemented as a class in most environments. The class has methods to open and close rulesets, load data and issue queries. Most of the methods are common across environments, although language specific methods are provided to use language-specific data collections, arrays, etc.
The API is under active development. The documentation is a first draft and is available from the ARulesXL program menu. The interfaces currently available or planned are:
The VBA interface is a special case, as it allows you to use VBA code with rule sets running in Excel. This lets you create more powerful ARulesXL/Excel applications. See the BudgetAnalysis.xls sample for an example of its use, although the call syntax is not in its final form yet.
The general methods are described in the new API Reference Manual. Each environment has its own chapter to discuss its installation, usage and language specific methods.
The Export command and ARulesXL API are part of the new beta test release and will be available in the new Professional Edition of ARulesXL to be introduced with version 2.0.
To subscribe or unsubscribe visit our website.
ARulesXL is a trademark of Amzi! inc. Excel is a registered trademark of Microsoft Corporation in the United States and/or other countries.