Export Task Child Sets
When exporting data, you may want to export both parent and child records. For example, the Travel Agency may want to export scheduled tours including the reservations for each of these scheduled tours to one file.
To export parent and child records, you need to define two external sets, one describing the structure of the parent data, and the other describing the structure of the child data. This last one is called a child set.
To specify the relationship between the parent external set and the child set, you have to:
To export scheduled tours including their reservations, define an EXP_SCHEDTOUR external set representing the SCHEDTOUR table, and an EXP_RESERVATION external set representing the RESERVATION table.
The SQL Statement of the EXP_SCHEDTOUR (parent) external set reads:
The SQL Statement of the EXP_RESERVATION (child) external set reads:
FROM schedtour s
WHERE r.schedtour_id = s.schedtour_id
Finally, manually add a new RESERVATIONS set element to the EXP_SCHEDTOUR external set, and attach the EXP_RESERVATION child set to it.
The child set will now be synchronized with the parent external set. This is possible because the schedtour_id primary key column is an element of the EXP_SCHEDTOUR parent external set.
For synchronization, USoft implicitly adds a join condition coupling records from the parent set with records from the parent table in the child set. If the parent table appears two or more times in the child set's FROM clause, the join is with the first table (reading from left to right) for which all primary key columns appear in the SQL statement.
An external set cannot have a child set if the query contains one of the set operators UNION, MINUS, or INTERSECT.