select command

The select command retrieves all items from the specified file reference that meet the optional selection criteria. The items are selected in the order of their appearance in the file reference. The selected item may be saved for future use or acted upon immediately.

When an output list displays in any of the various select sentences, the list is built from the contents of the specified attribute. If an item list is specified, items are selected in the order of the item-IDs in the item list. If no item list is specified, all items in the file are considered. In this case, they display in order by the group into which they hash; and within groups, in the order they were added to the file.

If output specifications are included, the values of the specified attributes, including empty values, are used to form the list. If omitted, the list is formed from the item-IDs. The list is a temporary list that is used by the next command as its implicit item list. The list can be permanently saved by using the save-list or sl command. The list can also be passed to an Output processor command or to a FlashBASIC program if the next TCL command executes that program.

The elements of the list can be used as item-IDs to reference data in any file, not just the file referenced in the select command. For example, if a select on one file is followed by a list on a different file, the list of item-IDs generated by the select are used as an item list in the list command.

output.specification specifies the attribute-defining item from which values are to be extracted for creation of the list. (See the example below.) This is somewhat similar to using qselect, with the additional provision for being able to specify collation order and selection criteria.

Note: The select command can use an index, if the index is created on the attribute, to narrow its selection criteria when using a relational and logical operator. If an index is available, the selection processor will use it when a single selection criteria is used or when the AND logical operator is used with two criteria. Indexes will not be used when the OR logical operator is used in the selection criteria.


select file.reference {item.list} {selection.criteria} {output.specification}
{modifiers} {(options}
Note: If by is provided with a command that does not naturally sort (such as the select command), the command is changed to its sorting counterpart (for example, select becomes sselect, and so on).


This builds a list of the item-IDs that match the given selection criteria.

select invoices with amount.due > "0"

This creates a nonsorted list of the contents of the order.pointers attribute. For items where the order.pointers attribute is empty, an empty value will be returned to the select list.

select customers with last.order.amount > "1000" order.pointers

This creates a sorted list of all invoices whose item-ID begins with the letter d and with an invoice date on or after January 1, 2005.

sselect invoices = ’d]’ with ge "1/1/05" by date