Setting scheduling options for the disk

Now that you have the InfoObject for the unmanaged disk destination, you can use the PluginInterface to set the scheduling options that are specific to Disk. These include only the complete path and filename of the instance.

For example:

DiskSchedulingOptions = Disk.PluginInterface("").ScheduleOptions;

DiskSchedulingOptions.DestinationFiles.Add(1,"C:\MyReports.rpt");

Once the Disk options are set, you must copy them into the Report.ScheduleInfo.Destination. This will cause the instance to be transferred to the required directory with the required file name after it has been processed. For example:

Report.SchedulingInfo.Destination.SetFromPlugin (Disk);

You are now ready to schedule the report using the InfoStore. The complete example for scheduling via unmanaged disk is given below. You can now choose to go to:

Example

function ScheduleToDisk(IStore,ReportId, FilePath)

{

    var Reports = IStore.Query("SELECT SI_ID, SI_NAME FROM CI_INFOOBJECTS WHERE SI_ID="+ReportId);

    if (Reports.Count == 0)

    {

        return;

    }

    var Report=Reports.Item(1);

    

    var ScheduleInfo ;

    //Create an interface to the scheduling options for the report.

    ScheduleInfo = Report.SchedulingInfo;

    // Run the report once.

    ScheduleInfo.Type = 0;

    // Run it right now.

    ScheduleInfo.RightNow = true;

    

    var Disk;

    var DiskSchedulingOptions;

    Disk = IStore.Query("Select Top 1* From CI_SYSTEMOBJECTS Where SI_PARENTID=29 and SI_NAME='CrystalEnterprise.DiskUnmanaged'").Item(1);

    DiskSchedulingOptions = Disk.PluginInterface("").ScheduleOptions;

    DiskSchedulingOptions.DestinationFiles.Add(1,FilePath);


    ScheduleInfo.Destination.SetFromPlugin (Disk);

    

    //Tell the APS to schedule the report.

    IStore.Schedule (Reports);

}



Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com