How do I setup Event Based Schedules in CRD?

Event Based Schedules give you the ability to run any already existing schedule (enabled or disabled) when an event occurs.

Event-Based Schedule for Crystal Reports.

Event-Based Schedules give you the ability to run any already existing schedule (enabled or disabled) when an event occurs. The purpose of the wizard will be to guide you through the process of setting up an Event-Based Schedule. Use this schedule on its own, or in addition to a regular time-based schedule for the same report.

With Event-Based Schedules, you can unlock the power of CRD's process scheduling engine. Combine Event-Based schedules with Custom tasks to automate processes such as updating databases, server management, or system alerts.

How to Create a Event-Based Schedule for Crystal Reports?

  • Go to Event-Based.
Event-Based - CRD Home Screen
crd eb general

General Wizard

  • Parent Folder: The CRD folder where the package is stored.
  • Schedule Name: The name of the package.
  • Description: Add a Description to the schedule to better identify it.
  • Keyword (optional): Enter some keywords which can be used later by Smart Folders to identify this schedule.

Click Next to go to the next wizard section.

Conditions Wizard

crd eb conditions
  • Fulfill:
    • ANY: The schedule will work if ANY of the conditions are met.
    • ALL: The schedule will only work if ALL of the specified conditions are met.
  • Enabled: Check this option to enable or disable the schedule.
  • Click Add to see all the Conditions type.
Crystal Reports: Condition Wizard in Event Based Schedule In CRD.

Database Record Exists

Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • This condition will cause the schedule to be executed if a database record exists.
  • If set to True, the schedule will be executed if the record exists e.g. when it is created.
  • If set to False, the condition will be executed if the record does not exist.
  • ODBC DSN Name: Drop down and select a DSN.

We strongly recommend System DSNs so that the DSN is visible to CRD even when the user associated with the DSN is logged off.

All communication to databases (including Access databases) is done through ODBC, so you must setup a system DSN to the database before you can use this facility.

When setting up DSNs we recommend (if possible) that you use Windows Authentication (Trusted Connection). This ensures that your username and password are not required to be stored in CRD (more secure) and overcomes a large number of security restrictions which Windows places on DSNs. When using Windows Authentication, make sure that the CRD NT service user (or background application service user) has full rights to the database otherwise, though you will connect when you are logged in, automated scheduling will fail if the Service user has not got rights to the database.

When setting up a DSN to a SQL server, you must ensure that the "Default Database" setting is set to the database you are connecting to (Windows defaults this to "Master").

  • UserID: Enter the User ID CRD should use to log on to the database
  • Password: Enter the password associated with the above user.
  • Click green arrow to continue.
Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • Click Build.
crd get values from database
  • ODBC Datasource Name: Drop down and select a DSN.
  • UserID: Enter the User ID CRD should use to log on to the database.
  • Password: Enter the password associated with the above user.
  • Connect: Click Connect to connect to the Database.
  • Select the table from the database that holds the required data. You can refine your selection query by using the simple or advanced tabs.
  • Click Parse.
  • For more information of "Get Values From Database" interface, click here.
Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • Click green arrow to continue.
Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • Select the Column that identifies the data in each row. This must be unique. It is typically referred to as the Primary key.
  • Detect - New Records Only: The schedule will only act on records that were created after you wrote the schedule and the schedule will only be fired once for each record. After the first run, it is deemed not to be new anymore and the schedule will not fire.
  • Detect - Any Matching Records: If this option is selected you should ensure that your query limits the returned values to just the record you are after. You must also write a custom action to update the database so that this record no longer fulfills the condition once the schedule has been executed, otherwise the schedule will continue to run each time it finds the same record.

For example:

The schedule should execute when a new sale over $1000 is entered: Select order id from sale stable where amount >= 1000

Now limit the query further by adding a second condition: Select order id from sale stable where amount >= 1000 and schedule sent <> 'T'

  • The schedule will only execute if it finds a sale over $1000 and the schedule sent field is not "t".

Now write a custom Task to update the database record and set schedule sent to 'T'. Update sale stable set schedule sent = 'T' where amount >= 1000 and schedule sent <> 'T'

  • When the schedule has executed, it will mark the record and thus ensure that the schedule does not repeat itself each time CRD polls the database.
  • Click green arrow to continue.
Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • Click OK.

Database Record Has Been Modified

Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • This condition will cause the schedule to be executed if a database record exists.
  • If set to True, the schedule will be executed if the record exists e.g. when it is created.
  • If set to False, the condition will be executed if the record does not exist.
  • ODBC DSN Name: Drop down and select a DSN.
  • UserID: Enter the User ID CRD should use to log on to the database
  • Password: Enter the password associated with the above user.
  • Click green arrow to continue.
Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • Click Build.
crd get values from database
  • ODBC Datasource Name: Drop down and select a DSN.
  • UserID: Enter the User ID CRD should use to log on to the database.
  • Password: Enter the password associated with the above user.
  • Connect: Click Connect to connect to the Database.
  • Select the table from the database that holds the required data. You can refine your selection query by using the simple or advanced tabs.
  • Click Parse.
  • For more information of "Get Values From Database" interface, click here.
Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • Click green arrow to continue.
Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • Select the Column that identifies the data in each row. This must be unique. It is typically referred to as the Primary key.
  • Detect Inserted and deleted Rows: CRD will monitor for inserted and deleted rows as well as data that has been modified.
  • If Database Record has been / has not been modified: Check for records that have been / have not been changed within a set time frame.
  • Click green arrow to continue.
Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • Click OK.

File Exists

crd eb condition file exists
  • This condition will cause the schedule to be executed if a file exists.
  • If set to True, the schedule will be executed if the file exists e.g. when it is created.
  • If set to False, the condition will be executed if the file does not exists e.g. if it is deleted.
  • Run once for all files found: The schedule will perform the specified actions once for each file found that matches the criteria.
  • Run for each file found: The schedule will perform the specified actions ONCE only irrespective of how many files are found.

File Details:

  • Local File: Monitor for files on Local File.

Hint: You can use the insert menu to create an ever-changing file name.

crd eb condition file exists local
  • Remote (FTP) File: Event-Based Schedule can also monitor for files on an FTP server.
crd eb condition file exists remote
  • Enter the FTP Server Information.
  • Verify: Authenticate to the server and enter the path where the file should be located.

Hint: Combine this feature with Custom Actions FTP and FTP Folder Housekeeping to set up automatic FTP maintenance.

File has been modified

crd eb condition file has been modified
  • This condition will cause the schedule to be executed if a file has been modified.
  • If set to True, the schedule will be executed if the file exists e.g. when it is created.
  • If set to False, the condition will be executed if the file does not exists e.g. if it is deleted.
  • Run once for all files found: The schedule will perform the specified actions once for each file found that matches the criteria.
  • Run for each file found: The schedule will perform the specified actions ONCE only irrespective of how many files are found.

Hint: You can use the insert menu to create an ever-changing file name.

Process Exists

Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • This condition will cause the schedule to be executed if a process exists.
  • If set to True, the schedule will be executed if the process exists.
  • If set to False, the condition will be executed if the process does not exist.
  • Type the name of the process in the drop-down box or use the drop-down arrow to select from a list of currently running processes.

Tip: Try setting up the schedule that will monitor for certain key processes on your server. If those processes are not running then CRD can automatically restart them.

Window is Present

Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • This condition will cause the schedule to be executed if a window is present.
  • If set to True, the schedule will be executed if the window is present.
  • If set to False, the condition will be executed if the window is not present.
  • Type in the window name, or use the drop-down to pick from a list of currently open windows.

Tip: Try setting up the schedule that will monitor for certain open Windows on your server. If those processes are running then CRD can automatically stop them.

Unread Email is present

  • Users can send report requests to a specified email address. CRD will read the email, and, if the conditions are met, fire off the specified report.
Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • Fill in your server credentials.
  • Click Test.
  • If you have entered them correctly, the green arrow will become available.
Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • Select the folder that will be monitored.
Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • Specify the condition. Select the email fields to determine what would meet your requirements.
  • Forward the Email: Forward the email to another address.
  • Redirect the Email: Send the incoming mail directly to another address instead of keeping it in the inbox.
  • Save Attachments: Pull attachments from the email and save them directly to a folder.
  • Move Email: Use this option to move the email to another folder located in your email.
  • Remove Matched mail from Server: Choose to clear the email from the inbox once CRD has processed it.
  • If you do use this function with the condition set to false, then be sure to remove the found email from the mailbox so that the report doesn't get fired off again (each time read emails are found).
Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • Click OK.

How to parse the values in the body of an email and insert them into CRD fields?

  • For an "Unread Email" event, CRD can read the body text of the email and place selected values into Event-based constants.
  • You can also use the "Exact Match" option which will match the Case of the email text. In addition, when this option is used, spaces before and after the phrase are NOT removed and form part of the matching string.

Here is an example:

  • Mary has an email which will contain values, and she wants the values to update a database. Here's how she would set it up in CRD.
  • Firstly, CRD will expect the email text to be in the format [Constant]:[Value]. Here is how Mary will set up her email:
EmployeeID: xxxxx
EmployeeName:yyyyy
EmployeeStartDate:zzzzzzzz
  • As you can see, the required constant is on the left of the colon (:) and the required data is on the right.
  • To insert the data into her database, Mary uses an "Update a database" custom task as shown below:
crd eb update database records
  • She inserts Event-Based Constants, selecting a Custom Constant:
crd inserts eb
  • She types in the Custom Field Descriptor:
  • When she drags the Insert, "<[e]Read my Email;To>" is placed in the field:
  • She clicks the down arrow to add the statement to the list. And repeats the process for all the custom constants she will need to parse the email.
  • This tells CRD to read the email body text and to place the value to the right of "EmployeeID:" in the database.

The colon (:) is only required in the email body. It is not used as part of the definition process above, but CRD will automatically read the value to the left of the colon and apply the data to the right of the colon.

Tip: Use email body parsing to customize other tasks! Pull information from one email and send an email using the data. Use it to create new database records, and much more!

Data received on a port

Crystal Reports: Condition Type Wizard in Event Based Schedule in CRD.
  • Name: Name the Condition.
  • If data has been received: Select true if you wish to monitor for data in the given port, or false if you wish to monitor for the absence of data in the given port.
  • Data is received on the following:
    • Port Number: Enter the port number that will be monitored.
    • Monitor on a Specific IP address: Enter the IP address that will be monitored.
    • Received Data: Select the data criteria using the lower menu. CRD will monitor for this data for any data matching your criteria.

Report Type Wizard

crd eb report type
  • New Reports: Display a screen where you can create a new reports schedule.
  • Existing Schedules: Displays a list of existing schedules in CRD for you to choose from.
  • None: Select this option if no schedules are to be ran if the conditions are met and only Customs Actions will be used.

Existing Reports

crd eb existing reports
  • A list of existing schedules will be displayed in the left hand pane.
  • Click on the schedule that needs to run if the conditions are met and use the green arrow to select it.
  • Schedules that are going to run if the conditions are met are shown in the right hand pane.
  • Click Next to continue.

Exception Handling Wizard

Crystal Reports: Exception Handling Wizard in Event Based Schedule in CRD.
  • Reports fail for any number of reasons - database connectivity issues, database is busy, network issues and more. This screen gives you the ability to tell CRD what to do if it encounters an error.
  • Treat as “error” if not completed in X minutes: If a report takes longer than the specified amount of time to run, this option will treat the schedule as an error and follow the appropriate action. The “Auto-calculate” option instructs CRD to automatically determine how long a schedule should take to run the report. If it takes longer than the calculated amount of time, then it is an error.

If manually determining the error timing, please double-check the run time of the report in order to get the correct time estimate.

  • On error, retry executing schedule every: If set to 0, CRD will deem the schedule as "Failed" the first time it encounters an error. The schedule will not run again until its next scheduled time. Change the value to tell CRD how many times you want it to retry running the report before declaring it as "Failed."
  • Override error email: Check this option if you want to specify an email address that receives the error alert when it fails. This overrides the default email specified in Options.
  • Hours of Operation: Event based schedules can poll 24 hours a day if required. Checking this option will allow you to set a specific time frame for when the event based schedule should run.
  • Schedule Priority: Set the priority level of the schedule. This will come into play when other schedules are running at the same time. If the priority is set to High then the event based schedule will take priority over other schedules in the queue.
  • If the priority level is set to low then it will be at the bottom of the queue and the other schedules will run first.

Click Next to continue to the next wizard.

Custom Tasks Wizard

crd eb custom tasks
  • In this section, you have the option of setting up custom tasks. Custom tasks are business process automation tools that can be auto-triggered before or after a report runs.
  • For more information on Custom Tasks, click here.
  • If you have no desire to add a Custom Task, you can click Next.
  • In the Event-Based Schedule, you can select a custom task to run as a result of any of the conditions being met.
  • After adding all the required Custom Actions, click Next to continue.

Execution Flow

crd eb execution flow
  • If you have schedules AND tasks being executed as part of the event-based schedule you can determine the order.
  • For Example:

Run Schedules then the Custom Actions

OR

Run the Custom Actions first, then the schedules, the run the Custom Actions again.

  • Click Finish.

Event-Based Schedule Context Menu

Crystal Reports: Event Based Schedule Context Menu in CRD.

Right-Click on a schedule to see the following actions.

  • Properties: Access the schedule set up for editing. Or you can just double click on the schedule.
  • Copy: Use this to copy an existing schedule. You can then paste it into another folder or the same folder. Simply open the folder you wish to paste to, right-click in the "white" space and select "Paste". Follow the on-screen instructions to complete the process.
  • Paste: Paste a previously copied schedule.
  • Rename: Rename a schedule.
  • Enabled: Schedules are enabled when there is a check beside this option. To stop a schedule from running, or to "pause" it for a while, select this option to remove the check. Disabled schedules will not run till they are enabled again.
  • Execute Schedule: This will execute the schedule immediately. Note that the next run date and time is not moved on as a result of a manual execution. This only moves on if the schedule is run automatically by one of the schedulers.
  • Delete Schedule: Selecting this option will delete the schedule.
  • Create Shortcut: Use this option to create a shortcut you can save in any location on your PC. Execute the shortcut to execute the schedule in CRD.

Event Based Schedules Properties

Crystal Reports: Event Based Schedule Context Menu in CRD.
  • To access your schedule properties, right click on a schedule and select properties.
  • Similar to the schedule wizard, you adjust settings to your schedule such as timing, error handling, or custom tasks.
  • General
Crystal Reports: Event Based Schedule Properties Wizard in CRD.
  • Conditions
crd eb conditions
  • Report Type
crd eb report type
  • Schedule Options
Crystal Reports: Event Based Schedule Properties Wizard in CRD.
  • Tasks
crd eb custom tasks
  • Execution Flow
crd eb execution flow
  • History: Review the schedule's history. Successes, failures, and other data is located here.
crd eb history