Log In    |    Knowledge Base    |    4D Home
Tech Tip: Updating the UserSet
Published On: September 8, 2000

The UserSet is only updated when you manually change which records are highlighted in an output form. It is not updated if you change the current selection via code.

Let's suppose you have 100 records displayed in an output form. Then you highlight all of them (this is easily done with the keyboard shortcut Ctrl-A on Windows, or Command-A on Macintosh). The UserSet now contains 100 records. Then you click a button on your form, which uses the REDUCE SELECTION command to reduce the current selection to 50 records. After you do this, the UserSet will still contain 100 records.

If you have an output form displayed, and you run code that changes the current selection, and you intend to make use of the UserSet, you should either empty the UserSet with CREATE EMPTY SET([TableName];"UserSet"), or remove the records from it that are no longer in the current selection. (You would do this with the DIFFERENCE command. Don't forget that in 4D v6 and higher, the UserSet is actually a local set.)

Related Links:
4D Server and Sets