Multiple Investors, Fact Arrays


Tutorial Index     Rules & Decision Tables     Column Queries     Arrays     Tables & Pattern Matching     Lists     VBA     Multiple Rule Sets     Array Queries


loans_04_property_arrays.xls

In this example there are two investors to consider, each with different criteria for the loans they will accept. They are Ace and Acme.

There are different ways to write the rules for the different investors. One way is to simply add a criteria to each rule:

Resell = "yes" WHEN investor = "Ace" AND ...

A more flexible way, that better separates the rules for different investors, is to use fact arrays.

A fact can have array indices associated with it in square brackets. For this example Resell is a fact array with decision tables for both Resell[Ace] and Resell[Acme]. Using these tables, the RQuery() now asks for either Resell['Acme'] or Resell['Ace'] as shown in the screen shot below. The single quotes are used instead of double quotes to make it easier to create and read the query.


loans_04_property_arrays.xls

Fact arrays can be used just as easily with rules instead of decision tables. Two such rules for this example would be:

Resell[Ace] = "yes" WHEN FICO >= 720 AND LTV >= 90
Resell[Acme] = "yes" WHEN FICO >= 680 AND Rate > 6.2 and Occupancy  = "Owner" 

Also, rather than hard coding the investor name in the query, it could be taken from that name at the top of the column. In that case the RQuery() in cell J6 would read as follows, picking up the investor name from cell J4:

=RQuery(ResaleRules, "FIND Resell[_1] WHEN FICO = _2 AND...      ", J4, D6, ... ) 

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.