b = selcase(ext-dict-name,alphanumeric-expression[,offset])
[include(dictionary-item])] [where logical-expression];
[ ] indicates that this part is optional.
The selcase function allows a data entry operator to select and load a case from an external file. This function can only be used in data entry applications. It searches the index of the external file named by "ext-dict-name" for all cases whose keys match the criterion specified by "alphanumeric-expression." If two or more matching keys are found, they will be presented to the entry operator in a display box. Using a highlight bar, the operator can select one of the keys. The case identified by that key is then read into memory.
The "offset" tells CSPro the number of characters, beginning with the first character of the ID items for the external file, that should be suppressed if multiple matches are found.
• alphanumeric-expression: can be a literal or a CSPro expression. The matching is case sensitive. If an empty string is passed, all cases in the external file are returned.
• include: tells CSPro to list additional items from the specified dictionary in the display box.
• where: applies the logical expression to all cases returned by the selcase statement. The resulting display box will only show cases in which the logical expression evaluated to true (returning a nonzero value).
The function returns a logical value of true (1) if a case is found or selected by the entry operator and false (0) otherwise.
OK = selcase(LOOKUP,concat(PROV, DIST));
OK = selcase(OCCUPATION_DICT, "Plantation");
will return cases whose key begins with "Plantation."
OK = selcase(OCCUPATION_DICT, "Plantation")
OK = selcase(OCCUPATION_DICT, "")
where OCCUPATION_CODE >= 631 and OCCUPATION_CODE <= 633;
will result in the same screen as appeared in Example 3.