cancel
Showing results for 
Search instead for 
Did you mean: 

Fail to schedule FullClient report (PDF, Inbox) from Java

Former Member
0 Kudos

This is occurring in XI Reports 3.1

I'm trying to schedule a Deski (FullClient) report through the Java API.

The report has a PDF format and Inbox destination...

It also has a prompt with a default value.

When I schedule the report through InfoView it does so succesfully.

When I try to perform the same action through the Java API... the scheduling does not work.

Here's a snippet of code I'm using:

=======================

loInfoObjects = moInfoStore.query("SELECT * FROM CI_INFOOBJECTS WHERE SI_NAME = '" + lsRptNm + "'");

loFullClientPubl = (IFullClient)loInfoObjects.get(0);

loFullClientPubl.properties().setProperty("SI_KIND", CeKind.PDF);

loFullClientPubl.getProcessingInfo().properties().setProperty("SI_KIND", CeKind.PDF);

loFullClientPubl.getSchedulingInfo().setRightNow(true);

if (loFullClientPubl.hasPrompts())

{

IFullClientPrompts loPrompts = loFullClientPubl.getPrompts();

IFullClientPrompt loPrompt = (IFullClientPrompt)loPrompts.get(0);

loPrompt.getValues().set(0, "123456");

loFullClientPubl.getPrompts().set(0, loPrompt);

}

else //This is the scenario that executes....

{

loFullClientPubl.getPrompts().add("Code").getValues().add("123456");

loFullClientPubl.getProcessingInfo().properties().setProperty("SI_HAS_PROMPTS", true);

}

loFullClientPubl.schedule(); //Schedule the report

=====================================

After I execute the code, I can see that an entry has been created in CI_INFOOBJECTS but no record of the scheduling shows up in infoView, not even as a "failed" report. It's as if the report had never been scheduled.

In CI_INFOOBJECTS ...

Unlike the manual scheduling, the SI_KIND, and SI_HAS_PROMPTS properties for the failed scheduling are not set to "PDF" and "true" as expected, but remain as "FullClient" and "false"

This is the reason why I set the properties programmatically prior to scheduling the report. While this did change the values in CI_INFOOBJECTS, it still did not fix the problem of scheduling, that is no reports show up in infoView.

Have any of you guys come across this? I'm stumped...

Thank you

Accepted Solutions (0)

Answers (1)

Answers (1)

aasavaribhave
Advisor
Advisor
0 Kudos

I think its your code.

Look at the code snippet below for scheduling.

-


//Retrieve the first object in IInfoObjects collection

IFullClient fcDoc = (IFullClient)oInfoObjects.get(0);

IFullClientFormatOptions reportFormat = fcDoc.getFullClientFormatOptions();

//Set schedule format.

int formatType = IFullClientFormatOptions.CeFullClientFormat.PDF;

reportFormat.setFormat(formatType);

//set prompts

IFullClientPrompts fcPrompts = fcDoc.getPrompts();

Iterator iter = fcPrompts.iterator();

while(iter.hasNext())

{

IFullClientPrompt fcPrompt = (IFullClientPrompt) iter.next();

fcPrompt.getValues().set(0,"new prompt value")

}

//Retrieve the ISchedulingInfo Interface for the Report object and set the schedule

//time (right now) and type (run once)

ISchedulingInfo schedInfo = fcDoc.getSchedulingInfo();

schedInfo.setRightNow(true);

schedInfo.setType(CeScheduleType.ONCE);

//Schedule the InfoObjects.

infoStore.schedule(oInfoObjects);

-


I haven't testing the setting prompts part but it should work. This will schedule to default location. To schedule to Inbox use the following:

-


IDestinationPlugin destinationPlugin = (IDestinationPlugin)infoStore.query("SELECT TOP 1 * "FROM CI_SYSTEMOBJECTS WHERE SI_NAME='CrystalEnterprise.Managed'").get(0);

//Retrieve the Scheduling Options.

//This interface is the one which allows us to add the file location for the scheduling.

IManagedOptions managedOptions = (IManagedOptions) destinationPlugin.getScheduleOptions();

managedOptions.setDestinationOption(IManagedOptions.CeDestinationOption.ceInbox);

managedOptions.setIncludeInstance(true);

managedOptions.setTargetObjectName("My Report Instance");

managedOptions.setSendOption(IManagedOptions.CeManagedSendOption.ceCopy);

//Set of users that will receive the instance.

Set userSet = managedOptions.getDestinations();

//Query for the id of a particular user that will receive the instance.

IInfoObjects users = infoStore.query("SELECT TOP 1 SI_ID " + "FROM CI_SYSTEMOBJECTS " + "WHERE SI_NAME='Administrator' AND SI_PROGID='CrystalEnterprise.User'");

if (users.size() > 0) {

IInfoObject user = (IInfoObject)users.get(0);

int id = user.getID();

userSet.add(new Integer(id));

}

IDestination destination = schedInfo.getDestination();

destination.setFromPlugin(destinationPlugin);

-


Thanks

Aasavari

Former Member
0 Kudos

Thank you Aasavari

Actually it turned to have been a housekeeping issue.

There were obsolete copies of the report in a different folder that I was not aware of. Since I was searching the reports by name when scheduling, I was picking up the old ones. Needless to say, all the failed instances of that report were in that folder as well.

When i sorted this out, I basically no longer had a need for setting properties manually.

The reports are now scheduling properly.

I have not had a chance to verify the contents of the reports generated and the code you provided could prove very helpful if I run into trouble with the prompt values.

Thank you again

- Ment.