Create and Restructure Sets


This guide covers topics such as: editing and existing set, creating a new set, adding a table to a set, referential integrity, child table filters, and more

Editing an Existing Set

Right-click on the set name in the Control Panel, and select Edit Set. The Set Editor appears.

  1. Creating a New Set

    From the Table/Sets tab of the Control Panel, click New > New Set or Table > New > Set or Set > New > Set.

  2. Select the primary table for the set from the Select the Primary Table for the Set dialog box.

  3. Click OK to display the Set Editor or Cancel to drop your inputs.

  4. Add a Table to the Set

    Select a table in the Set Editor and click the Add Link button to add a table to the set. The Define Link dialog box appears in which you specify the link properties.

  5. Child Tables

    Select a table from the Child Table drop-down list.

  6. Optionally, specify an Alias name for each child table in the set. This is especially useful if your set includes multiple links to the same physical table. For example a table called Addresses might contain both shipping and billing addresses. Your set might include two links to the Addresses table. You can label the links Shipping_address and Billing_address.

    Sets can include up to 40 child tables.
  7. Linking Fields

    Select the Parent key and Child key values. These fields are used to specify what information the parent and child tables have in common. For example, you are linking the Invoice table to the Customer table, and both tables share the field Cust_ID. You would specify Cust_ID for both the Parent Key and the Child Key.

    • Linking fields do not have to be a single field. For example, the invoice number in the Invoice table consists of two fields. The first field, Tran_Type, indicates whether the transaction is a sale or refund, and contains the value "S: or "R." The second field, Slip_Num stores an incrementing number (e.g., 001, 002, 003, etc.). The invoice number consists of the first field plus the second field, resulting in invoice numbers that look like: S001, R002, S003, etc. When you link the Invoice table to the Items table, the Items table has just one field to store the invoice number, Inv_NO. To link Invoice to Items, you specify Tran_Type+Slip_Num as the Parent Key and Inv_NO as the Child Key.
    • Linking fields in parent or child tables cannot be calculated fields.
    • Linking fields in child tables cannot be auto-sequence fields.
    Linking fields do not have to have the same name, but they do have to have the same type and length. For example, the Cust_ID field in the Invoice table may match the Cust_NO field in the Customer table.
  8. Link Types

    Select the Link Type. These radio buttons specify whether the link is a one-to-one link or a one-to-many link. There are three varieties of one-to-one links, these are:

    • "first match"

    • "closest match"

    • "last match"

    • The variations are used to handle situations in which there are either multiple matching records or no matching records. If there are multiple matching records, Alpha Anywhere links to the first matching record in the child table if you choose first match or closest match. If you select last match, Alpha Anywhere links to the last matching record. In cases where there are no matching records, Alpha Anywhere will automatically link to the record with the closest matching key value, if you choose closest match.

  9. Referential Integrity

    Decide whether you want to enforce Referential Integrity. Referential integrity helps keep your data consistent by not allowing child records to become unlinked from their parent. Alpha Anywhere has two variations of referential integrity:

    • "Cascade changes/deletes" - You are not permitted to change the child table's linking field value. If you make changes to the value of the linking field in the parent table, matching records in the child table are updated to reflect the change. If you delete the parent record, matching child records are automatically deleted.

    • "Prevent changes" - You can not change the linking fields in the parent or child tables.

    If you link tables with an expression, rather than individual fields (e.g. Customer_ID + Transaction_ID ), then in order for referential integrity to work, the order of the fields in the tables must match the order of the fields in the expression. For example, with the above linking expression, the Customer_ID fields must be before the Transaction_ID field in the table structure.
  10. Include record from Parent table

    Make a selection from the Include records from the Parent table list. This selection determines which records displayed when you step through the records of the set. The options are:

    • "Always"

    • "Only if a matching child record DOES exist"

    • "Only if a matching child record DOES not exist"

  11. Child Table Filter

    Optionally, enter an expression for the Child Table Filter. This expression gives you control over the manner in which records are linked. You can filter out child records based on a condition you set. One example is exclude child records with duplicate linking key values. Another example (if you built a set consisting of Customer as the parent and Transaction as the child) is to create a filter that selects only Transaction records that were entered within the last year.

    If you are using referential integrity, child-records that do not meet the filter expression are not considered. For example, if you change a value in a child record which then causes the record to be filtered out, deleting the parent record will no longer automatically delete the child record.
  12. Child Table Order

    Optionally, enter an optional expression in the Child Table Order field allows you specify how matching child records will be displayed.

    By checking the Unique Records Only check box, records with duplicate linking keys are filtered out. This can speed up set-performance if the table is linked using a one-to-one link, since Alpha Anywhere does not have to search through as many records before a link is made. The Unique option is not appropriate for a one-to-many link, since a one-to-many is used specifically to link multiple records with the same linking-key value. By checking the Descending order check box, you specify that you want child records to be listed in order from most recently entered to least recently entered, also known as First In Last Out (FILO). Descending order should generally not be used with a one-to-one link.
  13. Click OK to save or Cancel to discard your changes.

Remove a Table from the Set

Select a table in the Set Editor and click the Delete Link button to remove a table to the set. Deleting a table will also delete all of its child tables from a set.

View the Set in its Default Form

Click to display the modified set in its default form.


Global Calculated Fields

Clicking 'xy' displays the Define Calculated Fields dialog box. This dialog allows you to define calculations (known as Calculated fields) that will be available to all layouts based on this table. Refer to Calculated Fields for more information.