Previous Topic: Relationship Override TemplatesNext Topic: Example: Relationship Override Template


Create a Relationship Override Trigger Template

You can use the Relationship Templates dialog in a physical model to create a relationship override trigger template.

To create a relationship override trigger template

  1. Right-click a relationship line and click Relationship Templates.

    The Relationship Template dialog opens.

  2. Work with the following options:
    Referential Integrity Type

    Displays the name of the database action and referential integrity action (for example, CHILD INSERT SET NULL) that causes the associated trigger to fire. Select the RI action to which you want to attach the new template in the Referential Integrity Type list and click Attach.

    Trigger Template Override

    Displays the name of the user override trigger template that you want to generate for the corresponding referential integrity type. If the option is blank (- - -), you generate the template associated with the relationship type and RI action at the global level.

    Detach

    Detaches the trigger template override from the associated referential integrity type. You generate the template associated with the relationship type and RI action at the global level if it does not have an associated override trigger template.

    Built-in Trigger Template

    Lists the standard CA ERwin Data Modeler built-in trigger templates. To create a new template from an existing template, select the template in the Built-in Trigger Template or User Override list, enter a name for the new template in the Template Name box, and click Add.

    User Override Template

    Lists the user-defined trigger templates available in a model.

    Attach

    Attaches the selected user-defined trigger template to the selected referential integrity type.

    Add

    Creates a user-defined trigger template and adds it to the User Override list.

    Delete

    Deletes the selected user-defined trigger template.

    Template Name

    Displays the name of the selected template. Enter a new name for the new template in the Template Name box and click Add to create a new, blank template.

    Template Code

    Displays the template code in the selected built-in or user-defined trigger template. To add macro code, position the cursor in the Template Code box where you want the macro to be inserted, click Macro Toolbox to select a macro, double-click the macro to insert the macro code in the Template Code box, and enter the parameters, if any, in the Template Code box.

    Expanded Code

    Displays the trigger code as it will appear in the physical schema.

    Macro Toolbox

    Opens the Macro Toolbox where you can select a macro to add to the trigger template.

    Click Close.

    Your changes are saved and the dialog closes.

Note: You must select the User-Defined and Relationship Override check boxes for triggers during schema generation to generate a relationship override template in the schema.

More information:

Relationship Override Templates