• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Event-based Scheduling

A scheduled job can work with events in two ways: A job can wait to run until an event is triggered or it can be the one that triggers events upon success or failure of itself. Jobs using events keep the same scheduling rules with respect to dates and times and reoccurrences; however, the start dates don't imply when the report starts processing, but rather when the report starts listening for the event. The most common scenario around events is needing to wait for a data warehouse load to complete before a job is run. There are several steps involved in setting up this scenario. First, an event needs to be created. This can be done via the Crystal Management Console or programmatically. The next chapter discusses how to create events programmatically. Next, use the ISchedulingInfo to set up the preferred date/time and reoccurrence settings. Then call the getDependencies method to obtain the IEvents interface. Finally, call the add method passing in the ID of the event object. This object is found in the SI_SYSTEMOBJECTS table like the business calendars. The following code snippet shows scheduling a report to start listening for an event called “Data Warehouse Load” at 2 a.m. every morning for November:

IInfoObjects eventResults = iStore.query("SELECT SI_ID FROM CI_SYSTEMOBJECTS" +
    " WHERE SI_NAME='Data Warehouse Load'");
IInfoObject event = (IInfoObject) eventResults.get(0);
ISchedulingInfo sched = report.getSchedulingInfo();
IEvents events = sched.getDependencies();
SimpleDateFormat dateFormat = new SimpleDateFormat();
Date beginDate = dateFormat.parse("11/01/2004 02:00 AM");
Date endDate = dateFormat.parse("11/30/2004 02:00 AM");




Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint