Hi!
We have a Java application that (in a general way) gets webi document with a prompt, passes the required value to that prompt and schedules document in pdf format. The promt is date in format dd.MM.yyyy H:mm:ss. Prompt value is a command line parameter in dd.MM.yyyy. We are using BO XI R2, BusinessObjects Enterprise SDK. The problem: after scheduling returns 10706: The query cannot run because the prompt ‘Date:’ contains an invalid date. (Error: WIS 10706).
But when I schedule this instance via InfoView without changing any setting, it runs ok.
The code looks like this:
import com.businessobjects.sdk.plugin.desktop.webi.IWebi;
import com.businessobjects.sdk.plugin.desktop.webi.IWebiPrompt;
import com.crystaldecisions.sdk.framework.CrystalEnterprise;
import com.crystaldecisions.sdk.framework.IEnterpriseSession;
import com.crystaldecisions.sdk.framework.ISessionMgr;
import com.crystaldecisions.sdk.occa.infostore.*;
import com.crystaldecisions.sdk.plugin.destination.diskunmanaged.IDiskUnmanagedOptions;
import com.crystaldecisions.sdk.exception.SDKException;
IInfoObjects results = iStore.query(“SELECT * FROM CI_INFOOBJECTS WHERE SI_PROGID = ‘CrystalEnterprise.Webi’ AND SI_PARENTID = “+folderID);
if(!results.isEmpty()){
for(int i=0; i<results.size(); i++){
IWebi webiDoc = (IWebi)results.get(i);
if(webiDoc.hasPrompts()){
List prompts = webiDoc.getPrompts();
Iterator it = prompts.iterator();
while(it.hasNext()){
IWebiPrompt prompt = (IWebiPrompt)it.next();
List values = prompt.getValues();
String pName = prompt.getName();
values.clear();
if(pName.equals(Date:)){
values.add(args[0]+” 14:00:00”);
} else {
}
}
}
ISchedulingInfo scheduleInfo = webiDoc.getSchedulingInfo();
// Run the report once.
scheduleInfo.setType(CeScheduleType.ONCE);
// Run it right now.
scheduleInfo.setRightNow(true);
// Retrieve the IWebiFormatOptions object and specify the format.
webiDoc.getWebiFormatOptions().setFormat(2);
// Get the destination object from schedulingInfo
IDestination destinationObject = scheduleInfo.getDestination();
// Specify that we are writing to disk
destinationObject.setName("CrystalEnterprise.DiskUnmanaged");
// Get the Destination plugin. Note that the SI_PARENTID will always be 29.
IDestinationPlugin destinationPlugin = (IDestinationPlugin)iStore.query("SELECT * FROM CI_SYSTEMOBJECTS WHERE SI_PARENTID=29 AND SI_NAME='CrystalEnterprise.DiskUnmanaged'").get(0);
destinationObject.copyToPlugin(destinationPlugin);
IDiskUnmanagedOptions diskUnmanagedOptions = (IDiskUnmanagedOptions) destinationPlugin.getScheduleOptions();
diskUnmanagedOptions.getDestinationFiles().add(path);
destinationObject.setFromPlugin(destinationPlugin);
webiDoc.schedule();
}//for
}//if
Can anyone help with this problem?
Lidiya (BOB member since 2010-05-06)