Setting up extra task actions

In addition to importing and exporting data, you can add actions to your batch task. For example, to ensure that the data is handled correctly, the right people are notified, and the files are in the right format. You can set up external systems for managing regular actions, and associate them with your batch imports and exports.

About this task

Task actions can be completed by running a program, a custom plug-in, or by using operating system commands. The program or custom plug-in must have a command line so that it can be run from the operating system, and neither can prompt for user input.

Example actions that are needed before an import

You can import data from a number of different sources. To ensure that the data matches your data model, and is imported as quickly as possible, you can use an Extract, Transform, Load (ETL) process.

Extract

Before data can be imported into iBase, you might need to extract data from another data source. For SQL Server databases, you can call an SQL Server Integration Services (SSIS) package to move the data from the source.

Transform

To ensure that the data is in the best format to be imported, you can create and call a stored procedure to prepare it. To speed up the import, you might want to convert the data from a view to a table, or remove indexes from the tables that are imported.

Example actions that are needed after import

Clean up

After data is imported successfully, you can trigger various tasks to leave your system ready for future use. For example:

  • Deleting import files.

  • Exporting the import log to a timestamped text file.

  • Clearing the scheduler database.

  • Setting the date and time of the next import.

  • Reinstate indexes that were removed before the import.

iBase modifications

As the data that is present in your database has changed, you might want to update your database design. For example:

  • Regenerate code lists present in the database based on the data that is now present.

  • Adjust the icons used to highlight different aspects of the data. For example, age, gender, profession, and for links aspects of the connection such as the age the person connected to the event was when the event occurred.

Depending how the Scheduler service is configured, any program steps that follow a task is canceled if the program takes too long to run, and the task marked as canceled in the log. This cancellation does not undo any completed import or export.

Note: The cancellation does not apply to plug-ins.

Environment variables

When running a program before the task, the following environment variables will be set: IBASE_CONNECTION, IBASE_TASK, IBASE_TRIGGER, IBASE_SCHEDULE_ID. For running export tasks, additionally the variables IBASE_FAILED_EXPORT_COUNT, IBASE_FAILED_EXPORTS, IBASE_SUCCEEDED_EXPORT_COUNT, and IBASE_SUCCEEDED_EXPORTS are available. For import tasks the environment variables are the same, with IMPORT rather than EXPORT in the variable names.

Procedure

To set up an additional action to a bulk import or export task:

  1. Open the iBase Scheduler Configuration and click the Schedules tab to display the Schedules page.

  2. Select the required database connection from the Connections list.

  3. In the tasks area, click New.

  4. Enter a descriptive task name.

  5. In the Type list, select either:

  6. Select the timing of the action:

    • Perform actions before the task runs - the program or plug-in will run before the batch specification.

    • Perform actions after the task runs - if the import or export completes successfully, the program or plug-in will run after the last specification in the batch specification is finished.

  7. From the Action Type list, select:

    • Program - For operating system commands or programs that can be run from the command prompt.

    • Plug-in - For custom plug-in actions.

  8. Enter the details of the task actions:

    • For a program, the command-prompt parameters of an operating system file that you want to run. Browse for the location of the program file.

    • For a plug-in, its project and class names in the format project.class.

  9. Click OK to save the task.