Hello all. I am trying to discover the process for clearing saved report prompts via the SDK. I can get a hold of the report parameters easily enough, but I then cannot easily see the way to reset the saved prompt values to "[empty]".
It will be very nice to figure this out, as we often have several hundred reports at a time that need prompts cleared.
I am a Java developer, but any language example will do.
I appreciate any help you might provide.
Sincerely,
Matt :-\
I don't remember where I got this, but it works for me. You need write permission to the report for this to work.
public void clearParameters(CognosReportNetPortType oCrn) throws RemoteException
{
PropEnum props[] = new PropEnum[] { PropEnum.searchPath, PropEnum.parameters, PropEnum.executionPrompt };
BaseClass[] report = oCrn.query(getCamid(), props, new Sort[] {}, new QueryOptions());
if (report != null && report.length > 0)
{
Report selectedReport = (Report) report[0];
if (selectedReport.getParameters().getValue() != null && selectedReport.getParameters().getValue().length > 0)
{
int size = selectedReport.getParameters().getValue().length;
for (int i = 0; i < size; i++)
{
ParameterValue pv[] = new ParameterValue[] {};
selectedReport.getParameters().setValue(pv);
}
report = new BaseClass[] { selectedReport };
UpdateOptions uo = new UpdateOptions();
uo.setReturnProperties(new PropEnum[] { PropEnum.parameters, PropEnum.searchPath });
oCrn.update(report, uo);
}
}
}