Views - Events Tab
The Events tab allows you to view and create special actions when certain events take place. The tab looks like this:
Creating Actions for View Events
When a user accesses and modifies data in a record from a view through the DataSplice Remote Client, an associated event is triggered based on the user's data modification. For instance, if the user changes the value of a quantity field from 5 to 3 in a record displayed in his or her client window, then an update event is requested by DataSplice. If there are no actions associated with the view's update event, then DataSplice will attempt to perform the update directly against the table in the database. However, it is possible to associate customized actions to any of a view's event types.
View Event Types
- Before Insert - Perform an action before inserting a record into the database table.
- After Insert - Perform an action after inserting a record into the database table.
- Instead of Insert - Perform an action instead of inserting a record into a database table.
- Insert Error - Perform an action if an error occurred when inserting a record into a database table.
- Before Update - Perform an action before updating a record in the database table.
- After Update - Perform an action after updating a record in the database table.
- Instead of Update - Perform an action instead of updating a record in a database table.
- Update Error - Perform an action if an error occurred when updating a record in a database table.
- Before Delete - Perform an action before deleting a record from the database table.
- After Delete - Perform an action after deleting a record from the database table.
- Instead of Delete - Perform an action instead of deleting a record from a database table.
- Delete Error - Perform an action if an error occurred when deleting a record from a database table.
There are four actions that can be associated with any of the above events:
- Database Procedure - Supplies customized data processing by calling a database stored procedure. Database procedures may be performed by DataSplice before, after, or in place of normal operations, such as an insert. These procedures are created with the database, and are then called by DataSplice.
- Email Notification - Supplies email notification capabilities for the associated event type.
- Run Application – Shells to an external application. E.g. based upon an event action (like transferring parts to a new bin), a report writer could automatically print out a new barcode label.
- Plug-In Action – This action type has been set up to support customized data processing based on calling procedures that are external, yet visible, to the DataSplice server process (i.e. Java routines, C# libraries, etc…).
Creating a Database Procedure Action
|
To create a Database Procedure action for an event:
|
This will bring up the Edit Database Procedure dialog box:
To specify which database stored procedure to call and to bind field and/or attribute values to the procedure call:
- Enter the name of the procedure into Procedure Name text box. The procedure name may need to be qualified by the schema it resides in. To specify the schema owner, append the schema name followed by a colon to the front of the procedure name.
Example: schema:procedure_name
- Click on the Update button. If the procedure is valid, the list of parameters for the procedure will be displayed.
- Enter the condition(s), if there are any, under which this event action should be processed. Leaving the Condition field blank means that the action should always be processed.
- Turn the Continue on Failure checkbox on or off, depending on whether or not DataSplice should continue processing event actions if an error is encountered during the processing of this particular action.
- In the Param Value column, bind the desired field or attribute value to the parameter to be passed into the database procedure when it is called. Double clicking in the Param Value cell will bring up a dropdown list of available fields. Also, you can select the cell and type in the field's display name or attribute name that you want to bind.
Note: The${field display name}syntax is required when binding fields and attributes to a parameter. You can bind text literals and/or numeric constants by entering the desired value without the${value}notation. - Click the OK button.
The event action will appear in the view's Event list:
Creating an Email Notification Action
|
To create an Email Notification action for an event:
|
This will bring up the Edit Email Notification dialog box:
In the dialog box, enter the following information:
- Recipient - The recipient's email address. In the example above, recipient@mailserver.com could be replaced with a reference to an
${EMAIL_ADDRESS}attribute that could be used to determine the email address. - Sender - The sender's email address. In the example above, sender@mailserver.com could be replaced with a reference to an
${EMAIL_ADDRESS}attribute that could be used to determine the email address. - Subject - This is the subject heading for the email.
- Server - This is the mail server to use for sending emails. This must be an SMTP server.
- Condition - A DataSplice Where clause to specify under what conditions the action should be fired.
- Continue on Failure - Check box specifying whether or not DataSplice should continue processing event actions if an error occurs during the email attempt.
- Message Body - The body text of the email message.
All email settings will be able to contain attribute references that will be replaced when the email is sent. This will allow for useful things such as creating a MAIL_SERVER attribute that is referenced for the SMTP server. E.g. enter ${MAIL_SERVER} in the Server text box. Also, if the view's record contains an email address, then you can use the field to specify the recipient and/or sender's email address. Example: ${Field_Display_Name} or ${Attribute_Name}.
In addition, the body of the email can contain formatting codes (and field references) that will get replaced as follows:
- %u - Insert information about the current client connection, including the user name, domain, and IP address.
- %a - Insert a table of the current attribute settings.
- %r - Insert the settings of the current record (if available).
- %e - Insert information about the current error (if any).
- %% - Replace with a single percent character.
Creating a Run Application Action
|
To create a Run Application action for an event:
|
This will bring up the Edit Shell Application dialog box:
In the Edit Shell Application dialog box, enter the following information:
- Application - The application/external process to run. In the example above,
my_custom_process.batcould be replaced with a reference to an${APP_SHELL}attribute that could be used to determine, in this case, the particular.batto execute. - Parameters - The parameter values list that should be passed to the external process. In the example above,
${field 1}${field 2}represents two of the possible fields from a view. - Working Directory - The directory that the external process should start working from.
- Condition - A DataSplice
whereclause to specify under what conditions the action should be fired. - Continue on Failure - Check box specifying whether or not DataSplice should continue processing event actions if an error occurs.
Creating a Plug-in Action
|
To create a Plug-in Action for an event:
|
This will bring up the Edit Plug-In Action dialog box:
To specify which plug-in function/method to call and to bind field and/or attribute values to the plug-in method call, perform the following steps:
- Select the target plug-in from the Choose Plug-in dropdown selection box.
- Select the function/method you wish to execute from the Select Function dropdown selection box. A description of the function selected will be displayed in the Description box under the function dropdown.
- Enter the condition(s), if any, under which this event action should be processed. Leaving the Condition field blank means that the action should always be processed.
- Turn the Continue on Failure checkbox on or off, depending on whether or not DataSplice should continue processing event actions if an error is encountered during the processing of this particular action.
- In the Param Value column, bind the desired field or attribute value to the parameter to be passed into the plug-in function when it is called. Double clicking in the Param Value cell will bring up a dropdown list of available fields. Also, you can select the cell and type in the field's display name or attribute name that you want to bind.Note: The
${field display name}syntax is required when binding fields and attributes to a parameter. You can bind text literals and/or numeric constants by entering the desired value without the${value}notation. - Click the OK button.
The event action will appear in the view's event list:
. This will bring up the Create New Action dialog box (as seen at left).