Can any help me to resolve this issue . I have been trying to connect to BO server and after connecting and setting the parameters , trying to export it as pdf format, here my code fails saying missing parameter values.
Below code used to get the ReportClientDocument
IInfoObject infoObject = (IInfoObject) infoObjects.get(0);
IReportAppFactory reportAppFactory = (IReportAppFactory) enterpriseSession.getService("RASReportFactory");
//Open the report file
return reportAppFactory.openDocument(infoObject, OpenReportOptions._refreshRepositoryObjects , Locale.ENGLISH);
Below is code used for setting the parameters :
ParameterFieldController paramFieldController = clientDoc.getDataDefController().getParameterFieldController();
Fields parameterFields = clientDoc.getDataDefinition().getParameterFields();
for (int i = 0; i < parameterFields.size(); i++) {
IParameterField paramToChange = (IParameterField) parameterFields.getField(i);
String field = paramToChange.getName();
if (field.substring(0, 1).equalsIgnoreCase("@"))
field = field.substring(1);
else if (field.substring(0, 2).equalsIgnoreCase("V_"))
field = field.substring(2);
String value = null;
System.out.println("Fields: :i= "+i+ " "+field);
if (reportParam.get(field) != null)
value = reportParam.get(field).toString();
else
value = "";
IParameterFieldDiscreteValue newDiscreteValue = new ParameterFieldDiscreteValue();
System.out.println("Setting Parameter value :i= "+i+ " "+value);
newDiscreteValue.setValue(value);
ParameterField tempParam = new ParameterField();
paramToChange.copyTo(tempParam, false);
if (tempParam.getCurrentValues().size() > 0)
tempParam.getCurrentValues().remove(0);
tempParam.getCurrentValues().add(0, newDiscreteValue);
paramFieldController.modify(paramToChange, tempParam);
Below is the order where I am calling the various methods in order.
ReportClientDocument clientDoc = getDocumentFromInfoStore(enterpriseSession, crInfo.getReportsFolder(), reportName);
if (!setDatabaseLocation(crInfo,clientDoc, sUserId, isILIReport)) {
ReportLogger.debug("Error generating " + rptFileName + " report.<br/>"
+ "Report Following Error Details<br/>"
+ "Database Location could not be set.");
return null;
} else if (!setReportParameters(clientDoc,reportParam)) {
ReportLogger.debug("Error generating " + rptFileName + " report.<br/>"
+ "Report Following Error Details<br>"
+ "Database Parameters could not be set.");
return null;
} else if (!setFilter(reportParam, clientDoc)) {
ReportLogger.debug("Error generating " + rptFileName + " report.<br/>"
+ "Report Following Error Details<br>"
+ "Database Filters could not be set.");
return null;
}else if (!setFooterCriteriaInfo(reportParam, clientDoc)) {
ReportLogger.debug("Error generating " + rptFileName + " report.<br/>"
+ "Report Following Error Details<br>"
+ "Database Filters could not be set.");
return null;
}else if (!setSorting(reportParam, clientDoc)) {
ReportLogger.debug("Error generating " + rptFileName + " report.<br/>"
+ "Report Following Error Details<br>"
+ "Database Filters could not be set.");
return null;
}
Am I doing something wrong , your help is really appreciable !! -Thanks in Advance.
At last I have resolved this issue . And the solution is as follows
IParameterFieldDiscreteValue newDiscreteValue = new ParameterFieldDiscreteValue();
System.out.println("Setting Parameter value :i= "+i+ " "+value);
newDiscreteValue.setValue(value);
ParameterField tempParam = new ParameterField();
**paramToChange.copyTo(tempParam, true);**
by changing the copyTo method boolean value to true i.e., making a deep copy of the PrameterField Object resolved the issue . i.e., paramToChange.copyTo(tempParam, true);