A Userset is a set of records that the user has highlighted in an output window. Assuming that a database is running on version 6 (or later) of client-server, Userset is referred to as a local set meaning that it is stored in memory of the client computer. This is different from most sets which are stored on the server computer. Because a local set is stored on a different computer than the other sets, it must be copied to the same (server) computer as the other sets, before a Union / Difference / Intersect set commands are executed. The following examples removes the records highlighted in an output window from the current selection.
`Method: Remove_Highlighted
COPY SET("UserSet";"Highlighted_Records") `copy Userset to Set on server
CREATE SET([Table 1];"Current_Records")
DIFFERENCE("Current_Records";"Highlighted_Records";"Result_Set")
USE SET("Result_Set")
CLEAR SET("Current_Records") `remove the sets from memory
CLEAR SET("Highlighted_Records")
CLEAR SET("Result_Set")
The example above would not work if the DIFFERENCE command is execute with userset as one of its parameters.
For more information about using sets, consult chapter 42 "Sets" in the Language Reference Manual and Technical Note: 97-37 "Sets in 4D v6".
Note: The code in these examples must be execute from the output window itself.