Coded Lists

Updated May 2021; see History

Often, if a list has only a limited number of items, and especially if the description of those items might be lengthy, it makes more data processing sense to store the selected item as a coded number, rather than as text. For example, the program shown above (Combo Box Control (INFLD)) actually stores the choices for the Zona field as a B,1 value, maintaining a table which translates the numeric codes into the descriptions which are seen above. Rather than having to do this work separately, you can let INFLD manage the table by adding TYPE ||L, and specifying SETDEF as a list of pairs, i.e.

SETDEF=",01,Norte,02,Centro,03,Sul,04,Pink Zone,05,Hot Zone,06,Ozone,,"

In this case, INFLD displays just the descriptions, but returns to the program the numeric codes (in other words, letting the user and the programmer have it their own way.)

A sub-variation of the above causes INFLD to return both parts of the pair, i.e. "04,Pink Zone" if TYPE ||l (lower case L) is used instead of ||L.

Since INFLD typically trims the XMAX value to be no greater than the physical size of the entry parameter, you may need to map the variable used for the entry parameter large enough to display the descriptions in the coded list (rather than just large enough to hold the coded values).

History

2021 March, A-Shell 6.5.1701:  List substitution (INFLD type code ||l or ||L) now supports matching an empty field to a key entry in the list consisting of just blanks, provided that the xmin parameter is not zero and the O (optional) type code is not set. For example, in the list

/  /Nowhere/01/Up/02/Down/03/Middle/

passing an empty field to INFLD will now match against the Nowhere entry in the list provided XMIN>0 and field not optional. Previously, null fields were not initially matched against the list, resulting in the initial field display defaulting to nothing.