Check Detail Records

The Check Detail Records server behavior A server behavior is a reusable component for server-side development. They add blocks of code to your pages for accomplishing specific tasks. Dreamweaver comes with several default server behaviors and the InterAKT extensions add many more to this list. allows the developer check if any detail records related to the master record A database row from the master table. The master table is defined by a one-to-many relation to another table (the detail table) that is being deleted exist. If detail records exist, the delete transaction A transaction is a group of SQL statements whose effects are logically connected. Anything from simple queries to inserting, and deleting operations can be considered a transaction, as well as more complex groups of several statements which accomplish a specific task. is stopped, in order not to leave detail records that cannot be accessed.

To add a Check Detail Records trigger A trigger is a SQL procedure that performs an action when a transaction (INSERT, UPDATE, DELETE) occurs. You can use triggers to perform validation of input data, to automatically generate a value for a newly inserted row, to read from other tables for cross-referencing purposes, or to support alerts through e-mail messages. into the page, you must follow the next steps:

  1. First create a Delete or Custom transaction. The server behavior is implemented as a trigger, therefore a transaction must exist on the page, so that the trigger can register to it. If more then one transaction exists, the trigger will register to all of them.
  2. Access the server behavior from the Application panel, Server Behaviors -> + -> MX Kollection -> Form Validation -> Check Detail Records.
  3. The user interface that opens is divided into two tabs. Configure these tabs as follows:
    ·  The Basic tab, where options related to the actual check can be set.
    ·  The Advanced tab, where trigger specific options can be set.

  4. Once you're done setting the options, click OK to apply the server behavior.

The Basic tab

The purpose of this user interface tab is to allow the developer set up the check operation options:

 

To set the dialog box options, follow the next steps:

  1. In the Transaction table drop-down menu, the table used in the delete/custom transaction on page is automatically selected and the drop-down menu is disabled.

  2. In the Primary key drop-down menu select the table column containing the primary key of the transaction table.

  3. In the Detail table drop-down menu select the table which acts as a detail table for the transaction one. This means that its fields are related to the transaction table through a field.

  4. In the Detail foreign key drop-down menu, select the detail table column that stores the relation to the master table.

  5. In the Error message text area enter the text to be displayed when the check fails, meaning that the detail records do not exist. You can use the InterAKT Dynamic Data (the lighting bolt icon) to build the message.

  6. The three buttons in the top right corner of the interface offer you the next functionalities:
    ·  Click OK when you are done configuring the trigger.
    ·  Click Cancel to exit without applying the new settings.
    ·  The Help button opens this help page.
    These buttons are common to both tabs of the Check Detail Records interface.

  7. Click on the Advanced tab to continue with configuring the trigger.

The Advanced tab

The purpose of this user interface tab is to allow the developer to change the default trigger properties, to suit the particular situation. All trigger properties (name, type, priority, transactions) can be set from this dialog box:

 

For instructions on completing this step, see the Advanced tab. For the Check Detail Records trigger, by default the Priority is set to 40 and the Type is BEFORE (because checking if any detail records exist must be done before the delete transaction, so that it can be stopped).

The server behavior added this way can be edited later by double-clicking its name in the Server Behaviors tab of the Application panel.

Related Topics