Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Crystal Reports For Eclipse - Multi-values not showing on page..

Tried two different ways to set params, but to no avail. Values seems to be set, but only one value appears on the report.The value is updated, so not an old value or anything.

Also if I look at the values I can see the values are set! The Field is set to multi=true and the height is big enough to display lots of date grow=true.

<%@page import="com.businessobjects.samples.JRCHelperSample" %>

<%@page import="" %>

<%@page import="com.crystaldecisions.reports.sdk.ReportClientDocument" %>

<%@page import="" %>

<%@page import="" %>

<%@page import="" %>

<%@page import="" %>

<%@page import="" %>

<%@page import="" %>

<%@page import="" %>

<%@page import="com.crystaldecisions.reports.sdk.*" %>

<%@page import="*" %>

<%@page import="*" %>


// This sample code calls methods from the JRCHelperSample class, which

// contains examples of how to use the BusinessObjects APIs. You are free to

// modify and distribute the source code contained in the JRCHelperSample class.

try {

String reportName = "Report1.rpt";

ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);

if (clientDoc == null) {

// Report can be opened from the relative location specified in the CRConfig.xml, or the report location

// tag can be removed to open the reports as Java resources or using an absolute path

// (absolute path not recommended for Web applications).

clientDoc = new ReportClientDocument();

// Open report, OpenReportOptions._openAsReadOnly);

// ****** BEGIN LOGON DATASOURCE SNIPPET ****************


// Database username and password

String connectString = "jdbc:oracle:thin:@localhost:1521:XE";

String driverName = "oracle.jdbc.OracleDriver";

String JNDIName = "";

String userName = "darren";

String password = "darren";

// logon to database

//JRCHelperSample.logonDataSource(clientDoc, userName, password);

// Switch all tables on the main report and sub reports

JRCHelperSample.changeDataSource(clientDoc, userName, password, connectString, driverName, JNDIName);


// ****** END LOGON DATASOURCE SNIPPET ****************

// Store the report document in session

session.setAttribute(reportName, clientDoc);


// Create the CrystalReportViewer object

CrystalReportViewer viewer = new CrystalReportViewer();

// set the reportsource property of the viewer

IReportSource reportSource = clientDoc.getReportSource();


// set viewer attributes



// -

// MyParameter

String paramName = "MyParameter";

String theValue1 = "Hello";

String theValue2 = " World!";


// Method 2

//We will be using the ParameterFieldController quite a bit through-out the rest of this function.

ParameterFieldController paramFieldController = clientDoc.getDataDefController().getParameterFieldController();


Object[] multiVals = {theValue1, theValue2};

// sReportName - the report that contains the specified parameter field.

// sFieldName - the parameter field name.

// newValue - the collection of values to be stored in the parameter field.

paramFieldController.setCurrentValues("", paramName, multiVals);


// Method 1

Values values = new Values();



ParameterField paramField = new ParameterField();





Fields parameterFields = new Fields();




// Show parameter values to console

Fields fields = viewer.getParameterFields();

for (int i = 0; i < fields.size(); i++) {

ParameterField pf = (ParameterField)fields.get(i);

Values v = pf.getCurrentValues();

if (v.isEmpty()) {


} else {

System.out.println("v.size(): " + v.size());

for (int j = 0; j < v.size(); j++) {

ParameterFieldDiscreteValue pfdv = (ParameterFieldDiscreteValue)v.get(j);

System.out.println(pf.getName() + " - " + pfdv.getValue());




// Apply the viewer preference attributes


// Process the report

viewer.processHttpRequest(request, response, application, null);

Thanks in advance!

Not what you were looking for? View more on this topic or Ask a question