Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing multivalue parameters through ExportOptions

Status
Not open for further replies.

krysna

Programmer
May 20, 2008
22
I am trying to pass params to my report via a java servlet. It is exporting the report to a PDF.
Everything works fine for "single" params, but when I try to pass params with multiple values, I am only getting the first one.
Here is my code:
Fields fields = (Fields)request.getAttribute("parameterList");
logger.debug("passed in param fields:");
for (int i = 0; i < fields.size(); i++) {
ParameterField pf = (ParameterField)fields.get(i);
Values v = pf.getValues();
if (v.size() > 0) {
ParameterFieldDiscreteValue pfdv = (ParameterFieldDiscreteValue)v.get(0);
logger.debug(pf.getName() + " - " + pfdv.getValue());
try {
reportClientDoc.getDataDefController().getParameterFieldController().setCurrentValue("",pf.getName(), pfdv.getValue());
} catch (ReportSDKInvalidParameterFieldCurrentValueException e) {
logger.debug(pf.getName() + " is not valid!");
}
} else {
logger.debug(pf.getName());
}
}
I think it has something to do with using the discrete value, as that is for just a "single" value, but I can't figure out how to access the multiple values.

The code being used to add the multiple values is calling addElement() for each multi-value, but I can't figure out how to get those and pass them into my report.

Any help is greatly appreciated!
 
Guess I have another case of "post & solve"....
Here's how I did it, for anyone searching in the future:
Fields fields = (Fields)request.getAttribute("parameterList");
logger.debug("passed in param fields:");
for (int i = 0; i < fields.size(); i++) {
ParameterField pf = (ParameterField)fields.get(i);
Values v = pf.getValues();
String[] values = new String[v.size()];
for (int j = 0; j < v.size(); j++) {
ParameterFieldDiscreteValue pfdv = (ParameterFieldDiscreteValue)v.get(j);
logger.debug(pf.getName() + " - " + pfdv.getValue());
if (v.size() > 1) {
values[j] = (String)pfdv.getValue();
} else {
try {
reportClientDoc.getDataDefController().getParameterFieldController().setCurrentValue("",pf.getName(), pfdv.getValue());
} catch (ReportSDKInvalidParameterFieldCurrentValueException e) {
logger.debug(pf.getName() + " is not valid!");
}
}
}
if (v.size() > 1) {
try {
reportClientDoc.getDataDefController().getParameterFieldController().setCurrentValues("",pf.getName(), values);
} catch (ReportSDKInvalidParameterFieldCurrentValueException e) {
logger.debug(pf.getName() + " is not valid!");
}
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top