Skip to main content
Version: Next

USE SET

USE SET ( set )

ParameterTypeDescription
setTextName of the set to use

Description

USE SET makes the records in set the current selection for the table to which the set belongs.

When you create a set, the current record is “remembered” by the set. USE SET retrieves the position of this record and makes it the new current record. If you delete this record before you execute USE SET, 4D selects the first record in the set as the current record. The set commands UNION, INTERSECTION, DIFFERENCE and ADD TO SET reset the current record. Also, if you create a set that does not contain the position of the current record, USE SET selects the first record in the set as the current record.

WARNING: Remember that a set is a representation of a selection of records at the moment that the set is created. If the records represented by the set do change, the set may no longer be accurate. Therefore, a set saved to disk should represent a group of records that does not change frequently. A number of things can invalidate a set: modifying a record of the set, deleting a record of the set, or changing the criteria that determined the set.

Example

The following example uses LOAD SET to load a set of the Acme locations in New York. It then uses USE SET to make the loaded set the current selection:

 LOAD SET([Companies];"NY Acme";"NYAcmeSt") // Load the set into memory
 USE SET("NY Acme") // Change current selection to NY Acme
 CLEAR SET("NY Acme") // Clear the set from memory

See also

CLEAR SET
LOAD SET