Scheduling a report to run right now (JS)

This example retrieves the first report named MyReport.rpt, and schedules it to run every two months, starting immediately.


<%@ Language=JavaScript%>

<HTML>

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">

<!-- #include file=helper_js.csp -->


<%

{

    try

    {

//Retrieve InfoStore.

var IStore = GetSession("IStore");


//The following line queries for a report named ScheduledReport.rpt.

//Change the value of SI_NAME to the name of a report that has been scheduled.

var Result=IStore.Query("Select SI_SCHEDULEINFO From CI_INFOOBJECTS where SI_NAME='ScheduledReport.rpt'");


//Retrieve the first report.

var ReportObject=Result.Item(1);



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

var SchInfo = ReportObject.SchedulingInfo;


//Use the scheduling object to set the scheduling options.

//Schedule is monthly.


//Use the scheduling object to set the scheduling options.

//Schedule is monthly.

SchInfo.Type.Value=4;

SchInfo.IntervalMonths.Value = 2;

SchInfo.RightNow.Value = 1;


//Schedule the report.

//The line below is commented out in this example to ensure that the report

//is not changed. For this example to work correctly, however, this line must run.


//IStore.Schedule(Result);

Response.Write("The report has been scheduled to run right now.");

    }

    catch (e)

        {

    Response.Write("There were errors. Confirm that you are logged on and the sample has been appropriately modified.");

    }

}

%>




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