Creating Many-to-Many Sets

Description

A many-to-many set is created by defining a linking table that has one-to-many relationships with two different tables. In the sample AlphaSports database you can create a many-to-many set named Customer_Product with these steps:

  1. Display the Tables/Sets tab of the Control Panel.

  2. Click New > New Table (Design mode)... to create a new table with two fields. The first field is Customer_ID. It is an 8 character field sorted in Ascending order. The second field is Product_ID. It is an 8 character field sorted in Ascending order.

  3. Save the table as Customer_Product.

  4. Click New > New Set... to create a set.

  5. When the Select the Primary Table for the Set dialog appears, select "Customer_Product" and click OK.

  6. Click the Add link... button to display the Define Link dialog.

  7. In the Child Table field select "Customer".

  8. In the Child Key field select "Customer_ID" and click OK.

  9. Select the Customer_Product rectangle and click the Add link... button to display the Define Link dialog.

  10. In the Child Table field select "Product".

  11. In the Child Key field select "Product_ID" and click OK. The display will now look like this.

  12. Click Save, name the new set, and click OK.

    Alpha Anywhere does not support forms or browses that will display data from this type of set. However, you can use Xbasic routines to read from and write to the set.

See Also