Crystal Reports Integration

Use Parameters with Crystal Reports

Code Customization
Use Parameters with Crystal Reports (Not Applicable To Mobile)

The Crystal Reports API for .NET supports passing parameters from application logic into the Crystal Reports report file. Of course, the report file must be set up to use parameters in its selection clauses in order to work. Here's a code snippet that shows how to do this:

// Get the Parameter Field definitions from the report object.
CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions paramFields;
paramFields = reportObject.DataDefinition.ParameterFields;

// Create a Parameter Field Defintion to use with the API.
CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition pf;
ParameterDiscreteValue pfv;
ParameterValues currentValues;

// Select a specific parameter and get a pointer to its value list.
pf = paramFields["Param1"];
currentValues = pf.CurrentValues;

// Create a new parameter value.
pfv = new ParameterDiscreteValue();
pfv.Value = "This Is A Param!!!";

// Add the new parameter value to the list of values.

// pass the updated list of values to the report.

// export the document to the temporary file.

Customizations included in this wizard are provided as a sample to demonstrate a feature, and may work only in specific situations. The Iron Speed Designer support team cannot assist in the resolution of problems which may occur as a result of customizing your application or modifying a customization to fit a particular purpose.

Terms of Service Privacy Statement