Simple Record Lists

Description

A simple record list displays data from the primary table of the current session. You also have no control over column widths and what data is returned by the control. If you want more control, refer to the section on Advanced Record Lists. The syntax for a simple record list is:

[%K=Index/Query_Name%.Size VariableName]   - combo box
[%KE=Index/Query_Name%.Size VariableName]   - edit-combo box
[%KL=Index/Query_Name%.Size,Height VariableName] - list box
The combo box style restricts you to making a selection from entries in the record list, while the edit-combo box style allows you to enter any value.

Index/Query_Name is the name of an index or query list in the primary table of the current session. Size is the width of the drop down list or list in characters. For list boxes, a height parameter specifies the height of the list box in lines. If the Index/Query expression contains multiple fields, Alpha Anywhere automatically creates a separate column in the list for each column and uses a vertical line to separate the columns. For example, the following script displays a drop down record list control to prompt the user for the name of the client for whom a mailing label should be previewed:

tbl = table.reset("clients")
tbl.query_detach_all()
query.order = "lastname+firstname"
query.filter = ".t."
query.description = "Keylist"
indx = tbl.query_create()
ui_dlg_box("Record List",<<%dlg%
Print a mailing label for which customer?;
{lf};
Select customer lastname:;
[%K=keylist%.50key_selected];
{lf};
<*15&Preview!ok> <15&Cancel!cancel>
%dlg%,<<%code%
if a_dlg_button = "ok" then
    filter_expression = "lastname+firstname = '"+key_selected+"'"
    label.Preview("mail_labels",filter_expression)
end if
%code%)

This script produces the following dialog:

When the drop-down list is opened, the dialog looks like this:

In the above script the first six lines open the 'Clients' table as the primary table in the session using the TABLE.RESET()method. Then, a query called Keylist is created with an order expression of Lastname + Firstname. Since the order expression has two fields, the record list shows two columns. The filter expression of .t. selects all records in the 'Clients' table.

If this script was invoked by a button on a form that was based on the 'Clients' table then the TABLE.RESET()command that starts the script would be unnecessary and should be removed. This is because the 'Clients' table would already be the primary table of the session (since the form that was open was based on this table).

The record list is displayed by the command:

[%K=keylist%.50key_selected];

The record list displays the keys in the query called 'keylist'. The value selected in the drop down list is stored in the variable key_selected.

Limitations

Desktop applications only

See Also