Skip to Content
0
Former Member
Mar 23, 2009 at 09:04 PM

Publication fails to grab paramneters the first time, succeeds subsequently

18 Views

We use BO enterprise SDK to create and schedule publications. Each publication includes one crystal report. The publication is created and its properties (recipients, destination etc) are set and Crystal report is added to publication. Then report parameters are set using BO SDK (IReport and IReportParameter interfaces). All this is done programatically. The publication gets created and scheduled, but the very first time it runs, it fails with errors like this:

-


3:36:02,914 ERROR [SchedulingHelper] ERROR: Document job [1984] failed for ScopeBatch [1979]:

Document (({OrderDeatils.Ancestoruserid}=left("PortalAdmin_TNTA",InStrRev("PortalAdmin_TNTA","_")-1))) failed: {ProcessingUnit Name, Calendar Name, Period Name} Information is needed before this report can be processed.

-


However, the second time same code is run (again to create and schedule the publication with same name, it deletes the old publication that already exists), it runs fine and succeeds.

Has anybody seen this kind of error before? Is this something to do with the earlier deleted publication? The very first time, there is no publication existing with same name, so nothing is deleted. I am not sure if this is some way affecting the process. Any help to debug this problem will be appreciated.

Here is code used to set parameters:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

IPublication pub = getPublicationInfoObject();

IReport doc = (IReport) pub.getSchedulableDocuments().toArray()[0];

for (int p = 0; p < ((IReport)doc).getReportParameters().size(); p++)

{

IReportParameter rptParam = (IReportParameter)((IReport)doc).getReportParameters().get(p);

if (params.get(rptParam.getParameterName()) != null) {

IReportParameterValues paramValues = rptParam.getCurrentValues();

paramValues.clear();

if(rptParam.isDiscreteValueSupported())

{

IReportParameterSingleValue value = (IReportParameterSingleValue)paramValues.addSingleValue();

log.debug("Setting " + rptParam.getParameterName() +

" to '" + params.get(rptParam.getParameterName()) + "'");

value.setValue(((String)params.get(rptParam.getParameterName())));

}

paramValues.size();

}

}

doc.save();

commit();

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Thanks

Sonali