This version is out of date, covering development from v6.0.0 to v6.6.5. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

TinderboxSix Icon

Look-up tables

Lookup tables, from v6.3.0, allow simple value arrays. This lets some discrete values be mapped onto other values. For example, suppose some notes record the state in which each customer resides. Each state is assigned to a region and it is useful to know the sales region for given customer. Previously, a usual approach would be a set of if() statements:

if($State=="AL") { $Region = "South";} 

However, this is a tedious process if there are many states - it needs a lot of if() statements. Instead, for a Set, List, or String type of Attribute create a list of keyword/value pairs, separated by colons. Each colon-spearated pair is then separated from then next pair by a semi-colon as in a normal Tinderbox list - a semi-colon is not needed after the last pair.



Optionally a default value (for keywords with no match) can be defined:



This now allows actions like:


If the set does not contain the key value, .at() looks for an optional special default key ('default') and returns its value; if there is no default defined or it has no value, .at() returns an empty string.

Realistically, if using lookup tables the lookup value list will be defined in one notes and then reference by all others. Thus the last example above is more likely:


Lookup tables are able to specify several keywords that map to a common value. This is done by separating each keyword with the pipe character '|'. For example:


A structural representation of the above example is as follows. The first keyword/value set is in normal text, the second in italics, the third in bold, the default in plain text:


The number of keywords in each Keyword/Value set is discrete from other sets in the list.

Keywords are matched on exact, case-sensitive, strings. In the above example "Tess" will return "Hardy" but "tess", "Tes" or "Tessa" would return "anon". If no default had been defined, an empty string "" would be returned instead for the non-matching values.

A Tinderbox Reference File : Actions & Rules : Look-up tables