Lookups provide powerful capability to write data driven rules. Instead of coding every condition explicitly, lookups allow looking up values from a look table based on one or more keys.
A lookup table has one or more key columns, and one or more value columns. An example lookup table, where ‘member_tier’ and ‘booking_code’ are keys and ‘bonus’ and ‘point_bonus’ are value:
member_tier |
booking_code |
bonus |
point_bonus |
Silver |
E |
0.10 |
0.05 |
Silver |
M |
0.25 |
0.15 |
Gold |
E |
0.20 |
0.20 |
Gold |
M |
0.45 |
0.35 |
default |
|
0.05 |
0.05 |
The example assumes ‘bonus’ is a discount rate and ‘point_bonus’ is additional points awarded to different members.
Instead of coding how to compute the bonus based on member_tier and booking_code in rules using expressions, it can be looked up from the above lookup table.
Note: Lookup tables are csv files, NOT XLS files.