UNION

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 3


UNION (set1; set2; resultSet)

ParameterTypeDescription
set1StringFirst set
set2StringSecond set
resultSetStringResulting set

Description

UNION creates a set that contains all records from set1 and set2. The following table shows all possible results of a set Union operation.

Set1 Set2 Result Set
Yes No Yes
Yes Yes Yes
No Yes Yes
No No No

The result of a Union operation is depicted here. The shaded area is the result set.

The resultSet is created by UNION. The resultSet replaces any existing set having the same name, including set1 and set2. Both set1 and set2 must be from the same table. The resultSet belongs to the same table as set1 and set2. The current record for the resultSet is the current record from Set1.

4D Server: In Client/Server, interprocess and process sets are maintained on the server machine, while local sets are maintained on the client machines. UNION requires the three sets to be on the same machine. Consequently, all or none of the sets must be local. See the discussion 4D Server and Sets in the 4D Server Reference manual for more information.

Example

This example adds records to a set of best customers. The records are displayed on screen with the first line. After the records are displayed, a set of the best customers is loaded from disk, and any records that the user selected (the set named "UserSet") are added to the set. Finally, the new set is saved on disk:

   ALL RECORDS ([Customers])  ` Select all the customers 
   DISPLAY SELECTION ([Customers])  ` Display all the customers in a list 
   LOAD SET ("$Best"; "$SaveBest")  ` Load the set of best customers 
   UNION ("$Best"; "UserSet"; "$Best")  ` Add any selected to the set 
   SAVE SET ("$Best"; "$SaveBest")  ` Save the set of best customers 

See Also

DIFFERENCE, INTERSECTION.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next