Table Lookup Elements are a way to access information in a customisable table via two inputs which lookup a single output value. A Lookup Table needs to be created before you can use it with an element's Default Value Formula to populate an outcome.
Configure the Lookup Table in the Designer
1. Under the Designer tab, select the Manage Lookup Tables button to the right.
2. Select + Create Lookup and give your new lookup table a Name under the Details tab. Under Column Headers and Row Headers, enter some values. Separate each value by starting a new line.
On saving, the Name will automatically be converted to all-caps, with spaces replaced by an underscore. For example, if you enter 'My Lookup Table', this will save as 'MY_LOOKUP_TABLE'.
3. Now you have created the template for your lookup table, you can now fill in the table by selecting the Values tab of the table.
- Fill in the data in the table by clicking on the relevant cell.
- Edit a value by clicking its cell.
You cannot edit the values of the Column and Row Headers under the Values Tab. To make changes to these, navigate back to the Details tab of your table.
Configure the Element(s) Default Value Formula
Now the table is complete, you can use it with an element's Default Value Formula to lookup the outcome of two elements that match the values of a table's Column and Row Headers:
- Create three elements.
- The element that comes first in the formula will search for a match in the Columns of the lookup table. The element that comes second in the formula will search for a match in the Rows of the lookup table.
- Add this formula under the Defaults tab of the third element: TABLE_NAME(Element1, Element2)
When you run the Smart Form on the Axsy Mobile App, if 'Element1' and 'Element2' are given the values Paper and Scissors, the Default Value of 'Element3' will be Scissors Wins (referencing cell highlighted in Step 3).
If the value provided for either ROW or COLUMN does not find a match in the table, the formula will return an empty value.
Hardcode the Column or Row
Rather than having an element's value be used as the value of the row or column, you can also hardcode one of the values in the formula to a value of your choice.
Instead of the formula TABLE_Name(Element1, Element2) , you could hardcode the column value to be "Rock". The formula would then look like TABLE_NAME("Rock", Element2) .
When referencing the hardcoded value, remember to use either double or single speech marks to encapsulate it.