This function has many uses, but in particular it is a great benefit when templates are being used in different regions where there a slight but significant changes in language.
For example, a template being used anywhere in North America would need to take into account the different spellings of English words. It would be counter-productive to make one template for use in the USA, and another in all other English-speaking regions. The Lookup function helps to overcome this.
What is needed is that the template author establish the language of the required output document in the interview, with something like:
Then, in the document body where a word like “colour” (or “color”) is required, the Lookup function is used like this:
- The different possibilities in the list are delimited by semi-colons.
- Each possibility consists of a pair separated by a colon. The first in the pair is the “key” to be compared, and the second is the value when there is a match with the supplied key value (in this case when the value of data element Language matches either ‘en-gb’ or ‘en-us’).
- The value for language code ‘en-ca’ is not included in the list in the Lookup function. In a case like this, the first pair in the list will be matched against all language codes which are not ‘en-gb’ or ‘en-us’ – in other words the value for ‘en-gb’ is the default – and when the Language is ‘en-ca’, the result of the function will be “colour”.