Skip to main content
Install Relativities and download the synthetic examples before running this page. This page copies two filed tables into a rater and reads them. A base rate table has two keys, construction and protection class. A territory factor table lists some territories, plus one factor for all the others. The check proves that each lookup finds a row for every request the rules accept. The last sections show what to do when the filing leaves out some keys.

Declare the tables

  • dims names the key columns. A key is an enum, a band type, a Code or Bool.
  • The names after -> are the output columns, such as a rate or a factor.
  • The citation after the table name points to the page that prints the table.
  • columns maps a column name to a CSV header with a different name.
  • Territory is a code: a three-digit string. Code accepts any string that fits the pattern.
  • otherwise gives the factor for each territory the CSV leaves out.

Write the rows

Each table reads its rows from tables/ plus the table name and .csv. tables/BaseRate.csv:
tables/TerritoryFactor.csv:
  • An enum cell holds the member’s name, as a request sends it.
  • A band cell holds the band’s first value, such as 4 for the band 4 to 6.
  • A number cell holds digits with an optional decimal point.

Read the tables

lookup! takes the table and one key for each key column, in order. Read an output column after the dot:
Rate a frame dwelling of 200,000 in protection class 5, first in territory 101 and then in 999. The sample download includes this rater in relativities-examples/rsl/table-otherwise:
Territory 999 is missing from the CSV, so it takes the otherwise factor of 1.25.

Handle the keys the filing leaves out

Each lookup has to find a row. Take out the otherwise row, and territory 999 lacks a row. The check stops:
Choose the fix that matches the filing:

Accept only the keys the table lists

Key(TerritoryFactor) accepts only the territories that TerritoryFactor lists. The rater refuses any other territory before it calculates:
The table then needs only its filed rows. The sample download includes this version in relativities-examples/rsl/table-key:
Key(T) works on a table with one key column, of a Code or enum type.

Mark a row the filing leaves blank

Some filings print a row with a blank value, such as a log home that lacks a construction factor. Write unfiled in that cell:
A lookup that can reach that row fails the check:
Add the filing’s rule to the input, in place of the Construction - { log } form the message suggests. The rater then refuses a log home with that rule’s code:
Key(ConstructionFactor) also works here. It refuses a log home with INPUT-KEY-UNFILED.