The TableLookup Command – XpressDox

The legislated tariff for a particular type of fee that can be charged is worded something like this:

“Where the capital amount is less than or equal to $3000, the fee is $56;
Where the capital amount is greater than $3000 but less than or equal to $5000, the fee is $187;
Where the capital amount is greater than $5000 the fee is $277.”

The fee could be calculated as in the following snippet, using a sequence of When commands:

The fee for capital amount $«CapitalAmount» is «When(CapitalAmount «When(CapitalAmount > 3000 and CapitalAmount «When(CapitalAmount > 5000,$277)»

OR, we could use the TableLookup command as follows:

The fee for capital amount $«CapitalAmount» is $«TableLookup(CapitalAmount,'3001;56;0, 5001;187;0, 999999;277;0')»

If the command looks a bit intimidating, you’re in good company! But using the Command Editor you can use a wizard to help construct the command and table. Open the Command Editor from the XpressDox toolbar, and right-click on the TableLookup entry and choose one of the wizards.

Note the following:

  • The “rows” in the table are separated by commas, and the items in each row are separated by a semi-colon.
  • The entire table is enclosed in quotes.
  • It would be possible for the table to be sourced from a data source, for example, in which case suppose the data element name in which the table is stored is called FeeTable, then the Fillpoint would be «TableLookup(CapitalAmount,FeeTable)»