Progress
Language Reference
LOOKUP Function
Returns an integer giving the position of an expression in a list. Returns a 0 if the expression is not in the list.
SYNTAX
expression
A constant, field name, variable name, or expression that results in a character value that you want to look up within a list of character expressions. If the value of expression is unknown (?), the result of the LOOKUP function is unknown.
list
A list of character expressions that contains the expression you name with the expression argument. Separate each entry in list with a delimiter. The default is a comma. If list is the unknown value (?), the result of LOOKUP is the unknown value.
character
A delimiter you define for the list. The default is a comma. This allows functions to operate on non-comma-separated lists.
EXAMPLESThis procedure prompts the user for a New England state. The LOOKUP function tests the value against the list of states stored in the stlist variable. If there is no match (the result is 0), the procedure displays a message. Otherwise, the procedure prompts the user for another New England state.
The following example uses a different delimiter, which list all fields that have “sls” or “sales” as words in their standard Dictionary labels.
NOTES
- If expression contains a delimiter, LOOKUP returns the beginning of a series of entries in list. For example, LOOKUP("a,b,c","x,a,b,c") returns a 2.
- Most character comparisons are case insensitive in Progress. By default, all characters are converted to uppercase prior to comparisons. However, you can define fields and variables as case sensitive (although it is not advised, unless strict ANSI SQL adherence is required). If the expression or list is defined as case sensitive, the comparison between them is also case sensitive and “Smith” does not equal “smith.”
- The LOOKUP function is double-byte enabled. The specified expression can yield a string value that contains double-byte characters and the character delimiter can be a double-byte character.
SEE ALSO
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |