Crystal Reports XI Official Guide

Deleting objects is much like creating them. The InfoStore must be queried and multiple objects (often just one) retrieved. The collection of InfoObjects is iterated or accessed using the collection's get(index number) accessor method. Then, the collection's delete(IInfoObject) method is called and, finally, the entire collection is committed.

The following function deletes a specific recurring job (or subscription) for a specific user. Supplying the user ID is optional in this case.

[View full width]

public static void deleteRecurringSchedule(IInfoStore iStore,int userID, int scheduleID) throws SDKException { String queryString = "SELECT * " + " FROM CI_INFOOBJECTS WHERE SI_OWNER AND SI_RECURRING=1 "+ " AND SI_ID="+scheduleID; IInfoObjects scheds = iStore.query(queryString); if (scheds.size()==1){ IInfoObject sched=(IInfoObject)scheds.get(0); scheds.delete(sched); } iStore.commit(scheds); }

Категории