News, Events, Conferences, What's New About, Partners, Jobs Phone, E-mail, Address, Location Free Evaluation


home
products
product videos
customer support


Resources
Frequently Asked Questions

What is the recommended method for passing parameters?

Download PDF version of this faq: Parameters.pdf

The preferred and recommended method for setting a parameter value is "AddParameterCurrentValue". This method takes 3 arguments and they are:

  1.    field name
  2.    subreport name
  3.    parameter value (PCREValueInfo)

// set parameter string datatype
PCREValueInfo ValueInfo = new PCREValueInfo();
ValueInfo.viString("Mary is THE BOMB!");
job.AddParameterCurrentValue("P6_String","",ValueInfo);

Once the parameter value has been specified the "GetNthParameterCurrentValue" method can be used to get the value back. This method retrieves the nth current value of the specified multivalue parameter.

It takes 3 arguments namely:

  1. fieldName - name of the parameter whose value you want to retrieve.
  2. reportName - name of the sub report. If the parameter is in the main report, use empty string "".
  3. parameter index - short, index number of the value to be retrieved (zero in case the parameter has a single value).

PCREValueInfo valueInfo = ajob.GetNthParameterCurrentValue(“fieldname”, “”, (short)0);

If the parameter is in the main report then an empty string needs to be passed. If the parameter is in the subreport then the sub-report name needs to be passed.

If your application tries to get a parameter value before the parameter value has been set it will generate an error similar to the following:
"com.mobileapps.pcre.PCREAPIError: No error."

Sample

Dynalivery has created the simplest sample possible for showing the preferred method for setting parameter values. We have created a report file that takes 7 parameters. We have set default values for some of the parameters in the report. The java code provided with this sample uses AddParameterCurrentValue method to programmatically change the value of the parameters.

To use this code be sure to modify the SimpleAppParam.java file to reflect your report server name, the location of the .rpt file and the output path.

Download sample from here.

This table maps SQL server data types with the corresponding Crystal data types.

For this SQL Server data type… Use this corresponding Crystal data type.
Bit Boolean
Money, SmallMoney Currency
DateTime DateTime
SmallDateTime Date
SmallDateTime Time
VarChar, Char, nVarChar, nChar String
Decimal, Float, Int, Real, SmallInt Number

BACK TO TOP
BACK TO START

© 2000-2005 Dynalivery Corporation
formerly Mobile Application Servers, Inc.