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 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 may 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.

Syntax

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).

Example(s)

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.

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 invoice.date ge "1/1/05" by date