Next >> << Prev

9. Run Pre-Conditions: Control execution of Exports and Loads

Run preconditions are a powerful way to add logic to Exports and Loads. They allow you to trigger the run of an export or load only if specified conditions are met.

Note: Pre-Conditions are only available in DMT Enterprise Edition.

Adding and Editing Pre-Conditions

Pre-Condition Link

Pre-conditions can be added to almost every type of groups and jobs.

To add or edit run pre-conditions, select the requested group or job and click on the Pre-Conditions link. It opens the Run Pre-Conditions form, where you can define the pre-conditions to use.

The check box on the left of the link indicates if pre-conditions are present for the group or job.

Pre-Conditions Types

There are 2 types of pre-conditions:

  • SQL Query: Runs an SQL query against any ODBC connection. The pre-condition is met depending on the result of the query.
  • File: Checks the existence of a file and optionally its content. The pre-condition is met depending on the presence and optionally content of the file.

When you set some pre-conditions to a group or job, they are all added together. i.e. If you set an SQL query and a file pre-condition, they will both be checked and will both have to be met in order for the group or job to be run.

 

9.1. SQL Query Pre-Conditions


This type of pre-condition runs an SQL query against any ODBC connection. The pre-condition is met depending on the result of the query.

To set an SQL query pre-condition, just tick the corresponding check box and populate the fields.

Query Pre-Conditions

In the example on the left, the pre-condition is satisfied if the control table T_CONTROL contains at least 1 record with a delivered date of today.

The commands at the bottom apply to the overall pre-conditions (see below).


Database Connection: In this field, choose the database connection to use to run the SQL query. The database connection can be any ODBC connection available.

You can define the ODBC connections in the Settings Tab.

Pre-Condition Met if the following Query: This field indicates whether the pre-condition is met when the query returns 1 or more rows or no rows.

Enter the SQL query in the edit box just underneath. You can enter any SQL statement understood by the ODBC driver you're using to access your data source.

Test Query Pre-Cond: Click this button to test your pre-condition (i.e. it will run the SQL query you've entered).

 

9.2. File Pre-Conditions


This type of pre-condition checks the existence of a file and optionally its content. The pre-condition is met depending on the presence and optionally content of the file.

To set a file pre-condition, just tick the corresponding check box and populate the fields.

File Pre-Conditions

In the example on the left, the pre-condition is satisfied if the file "Sales Delivery.txt" exists and its content begins with "OK".

The commands at the bottom apply to the overall pre-conditions (see below).


Pre-Condition Met if the following File: Enter here the full path of the file you want to check for the pre-condition. You can enter the file name manually or click on the button on the right ( > ) to open the file selection form.

Select one of the 3 option buttons below:

  • Doesn't Exits: The precondition is met if the specified file doesn't exists.
  • Exists: The precondition is met if the specified file exists.
  • Exists and Content begins with: The precondition is met if the specified file exists and its content begins with the text you enter in the edit box below.

Test File Pre-Cond: Click this button to test your pre-condition (i.e. it will check for the file presence and optionally content).

 

9.3. Overall Pre-Conditions Commands


Remember that when you set some pre-conditions to a group or job, they are all added together and checked one after the other before the group or job is run.

When Overall Pre-Cond aren't met: Indicate the behavior when the overall pre-conditions aren't met.

  • Generate a Warning: (default) A warning is generated.
  • Generate an Error: An Error is generated. This option is useful for jobs within groups. If an error is generated (rather than a warning), the job will "fail" and will make the whole group fail.

Test Overall Pre-Cond: Click this button to test your overall pre-conditions (i.e. all the pre-conditions set for this group or job).