Scheduling to a Server Group

There are several reasons why a Crystal Enterprise system might be broken up into server groups. Servers could be split up by geography, or by the database server they access. If this is the case, it's often a requirement when scheduling that the report job run on a server in a specific server group. This is programmatically set via the ISchedulingInfo interface. The setServerGroup method can be called to indicate which server group to use. It accepts an integer that is the ID of the server group. The ID can be obtained by an InfoStore query. In addition, the setServerGroupChoice enables the developer to specify an additional level of control. It accepts a member of the GroupChoice enumeration as described here:

  • GroupChoice.FIRST_AVAILABLE: Use the first available server, regardless of which server group it belongs to.

  • GroupChoice.PREFERRED: Use a server in the specified server group if possible, but otherwise fall back to the next available server.

  • GroupChoice.SPECIFIED: Use only servers in the specified server group.

The following code schedules a report using a preferred server group of 'Vancouver Servers':

IInfoObjects serverGroupResults = iStore.query("SELECT SI_ID FROM CI_SYSTEMOBJECTS WHERE
 SI_NAME='Vancouver Servers'");
IInfoObject serverGroup = (IInfoObject) serverGroupResults.get(0);

ISchedulingInfo sched = report.getSchedulingInfo();
sched.setRightNow(true);
sched.setServerGroup(serverGroup.getID());
sched.setServerGroupChoice(ISchedulingInfo.GroupChoice.PREFERRED);
iStore.schedule(results);

All the settings around scheduling discussed this far in this chapter have been accessed via the ISchedulingInfo interface. These options are directly tied to the actual scheduling process. However, there are some other options that are relevant when scheduling that are accessed through the IReport interface. They are as follows:

  • Output format

  • Database credentials

  • Parameter values

  • Selection formula

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.69.163