identifing a scheduled business object report

2.6k Views Asked by At

I am doing a java application that has to download only scheduled reports from a Business Object Server. For scheduling the reports I am using Info View the following way

1) Clic on the report 2) Action --> Schedule 3) Set Recurrence, Format and Destinations

The report then has a number of instances, as opposed to not scheduled reports, which have zero instances.

In the code, for separate the scheduled reports I am using

com.crystaldecisions.sdk.occa.infostore.ISchedulingInfo

IInfoObject ifo = ((IInfoObject) result.get( i ))
ISchedulingInfo sche = ifo.getSchedulingInfo();

this should give info about scheduling right? but for some reason this is returning an object(not a null, how I suppose it should return) for not scheduled reports. And the info returned by its methods (say getBeginDate, getEndDate, etc) are similar for both kinds.

I tried to filter the reports using SI_CHILDREN > 0 the query

SELECT * FROM CI_INFOOBJECTS WHERE SI_PROGID = 'CrystalEnterprise.Webi' "
+ AND SI_CHILDREN > 0  AND SI_PARENTID = " + String.valueOf( privateFolderId )
+ " ORDER BY SI_NAME ASC "

is this a right way to filter the scheduled reports?

2

There are 2 best solutions below

2
On

A scheduled report will have a child instance which holds the scheduling information and has the scheduled report as its parent. (You can see this instance in the history list in BI Launch Pad.)

You can retrieve recurrently scheduled child instances from the CMS like this:

SELECT * FROM CI_INFOOBJECTS WHERE SI_PROGID = 'CrystalEnterprise.Webi' 
and si_recurring = 1 

This will isolate any the reports which are scheduled to be executed (or to be more precise, the child "scheduling" instances described above). You can then call getSchedulingInfo() on the child instance to get further info about this scheduling.

Bear in mind the the SI_PARENTID field, not the SI_ID field, returned by the above query gives you the ID of the initial WebI report.

0
On

So Webi, Crystal etc. implement the ISchedulable interface. This means that your non-instance InfoObject WILL return an ISchedulingInfo, regardless of whether or not it has been scheduled.

If an object is scheduled, an instance is created with SI_SCHEDULE_STATUS = 9 (ISchedulingInfo.ScheduleStatus.PENDING)

The job then runs (SI_SCHEDULE_STATUS = 0), and either completes (SI_SCHEDULE_STATUS=1) or fails (SI_SCHEDULE_STATUS = 3). It can also be paused (SI_SCHEDULE_STATUS = 8)

So to find all instances that are scheduled, you need a query like:

select * from ci_infoObjects where si_instance=1 and si_schedule_status not in (1,3)

This will get you anything that isn't a success or a failure