Develop > Tailoring > Data management > Cascade Updates

Cascade Updates

The Cascade Update utility allows Administrators to maintain database integrity and consistency by altering or deleting the data in one or more dependent files to match changes made to data in a source file.

For example, incident records are linked to the contacts table by the contact name (probsummary, contact.name = contacts, contact.name). If someone were to edit the contact record and change contact.name, the associated incident records would lose their link and become orphaned. You could set up a Cascade Update record to monitor the contact.name field in contacts and change the contact.name field in related incident records to match accordingly.

Cascade Update example

In this Cascade Update example DEFAULT HQ has moved and now needs to update all of their contact records to reflect the new location "DEFAULT CORPORATE". Use the Cascade Update Utility to automatically update all DEFAULT HQ contact records when the location has been updated in the DEFAULT HQ location record.

There are two phases to make this happen:

  • Add a trigger record.
  • Add a Cascade Update Configuration record.
  1. Set a trigger to monitor the location file and call the RAD application, cascade.update.wrapper, when the location record is updated (After Update) in the location file.
  2. Configure a Cascade Update Configure Record to update the location in all contact records associated with that same location.
  3. Test the Cascade Update.

Create a Cascade Delete

To set up a Cascade Delete between two related tables (for example probsummary and problem):

  1. Open the erddef table using Database Manager.
  2. Select or create the erddef record that defines the relationship between the two tables.
  3. Select the Cascade Delete option.
  4. Save and Exit.

Alternatively, you can use the Cascade Update tool and follow the instructions in that tool to set up the Cascade Deletes there.

Create a Cascade Update

To create a Cascade Update:

  1. Create a trigger record to monitor the source table.
  2. Create a Cascade Update configuration record to set parameters for the update.

Create a Cascade Update/Delete Configuration Record

  1. Click Tailoring > Tailoring Tools > Cascade Updates.
  2. Click Search.

    A list of cascade update/delete configuration records opens.

  3. Select a configuration record to open it.
  4. Fill in all necessary fields.

    Note: For more detailed information on the fields, insert your cursor in that field and press Ctrl+H.

  5. Click Save to save changes to an existing record.

    Caution: If you are attempting to add a new record from an existing record, make sure that you do not click Save because doing so will replace the existing record with the new record. If you are adding a new record, click Add.

  6. Click Add to add a new record.

Create the example Cascade Configuration Record

  1. Click Tailoring > Tailoring Tools > Cascade Updates.
    The Cascade Update/Delete Config Record opens.
  2. Type the following information in the Cascade Update/Delete Config Record:
    • Name: location
    • Type: After Update (Configuration Rules)
    • Target File: contacts
    • Execute Condition: location in $L.new~=location in $L.old
    • Update Type: Cascade Update
    • Source Key: location
    • Target Key: location
    • Source Fields: location
    • Target Fields: location
  3. Click Add.
    Service Manager displays the message:
    Cascade Update Config record updated.

Create the example trigger record

  1. Click Tailoring > Database Manager.
  2. In the Form field, type:triggers
  3. Press Enter.
    The trigger record opens.
  4. Type the following information in the triggers record:
    • Trigger Name: update.contact.location
    • Table Name: location
    • Trigger Type: 4 - After Update
    • Application: cascade.update.wrapper

    If you are configuring a Cascade Update for device records, type am.cascade.update.wrapper in the Application field. This wrapper works with the device joindef files.
  5. Click Add.
    The message line indicates that the trigger record was added.

Test the example Cascade Update

  1. Click Tailoring > Database Manager.
  2. In the Form field, type the following:  contacts
  3. Press Enter.
    Service Manager displays a list of forms matching your search criteria.
  4. Double-click contacts.
    The contacts.g form opens.
  5. Click Search.
    Service Manager displays a list of all contact records.
  6. From the pull-down options menu, select Modify columns.
  7. Use the drop-down arrow to change the company field to location.
  8. Click Proceed.
  9. Click in the heading of the location column to sort the list so that all contacts with the same location are shown together.
  10. Open a second session of Service Manager.
  11. Click Tailoring > Database Manager.
  12. In the Form field, type the following: =location.
  13. Click Search or press Enter. The Search location records form opens.
  14. Click Search.
    Service Manager displays a list of all location records.
  15. Double-click on an ACME HQ record in the record list.
    The ACME HQ location details form opens.
  16. Change the location by typing ACME CORPORATE in the Location field.
  17. Click Save.
    Service Manager displays the message:
    location record updated.
  18. Revert to the first session of Service Manager, which is still showing the record list of contact records.
  19. Click Refresh.
  20. All of the ACME HQ locations are now ACME CORPORATE.