Lookup() Function
Lookup(cCodeType, cValue) returns the description of a code. Whenever a field has a lookup button that displays a list of valid entries, these entries are stored in the Codes database. Each code has a code type that is usually the field name. For example, all What codes for events are stored with a code type of "WHAT" to identify the field they belong to. Since all codes have a description, it is often useful to output the description instead of the code itself. So for an events report to show the looked-up description for "F-SDCOMP", you need to supply both the code type and the code itself:
The full syntax definition for the function is:
lookup( string, cCode, cDefaultIfBlank, cProperty, , lBlankIfBlankWho )
Lookup("WHAT", "F-SDCOMP") will return:
"File a complaint in San Diego."
You would, of course, usually pass the What field so each record's What code will get looked up:
Lookup("WHAT", Events->What) will return:
"File a complaint in San Diego."
if the current event's What code is F-SDCOMP.
Another usage is to expand the state abbreviation to full words for states:
Lookup("STATE", names->State)
This tells Abacus to lookup the names->State field in the codes database for the STATE codes and return the description.
How to avoid seeing the description “All People”
When the WHO code is blank, the string returned by Lookup() is "All People". There are situations in which it's preferable to return an empty string instead. A third parameter can be used to specify the default Who description to return in case the WHO code is blank. If the user wants Lookup() to return a blank instead, the syntax will be like this: Lookup( "WHO", matters->attorney, "" ).
NOTE: You could also pass any OTHER text to be the description for a blank code, such as “<blank>” whatever helps the current context. This applies ONLY to WHO codes.