Parameters prompt the user of a report to enter information. Think of a parameter as a question that the user needs to answer before the report is generated. The information users enter, or the way they respond, determines what appears in the report. For example, in a report used by salespeople, there might be a parameter that asks the user to choose a region. The report would return the results for the specific region, instead of returning the results for all of the regions.
By using parameter fields in formulas, selection formulas, and in the report itself, you can create a single report that you can modify whenever your needs change. Parameter fields can also be used in subreports.
If a parameter is missing or is invalid, the program shows an error. Setting the EnableParameterPrompt property of the Crystal Report Viewer to true causes the report to prompt the user for the parameter again instead.
There are a number of things to keep in mind when working with parameter fields:
Data Type | Explanation | Parameter Example |
---|---|---|
Boolean | Requires a yes/no or true/false answer. | Include planned budget numbers in the summary? |
Currency | Requires a dollar amount. | Display customers with sales over XXXXX. |
Date | Requires an answer in a date format. | Enter the start and end dates of the quarter. |
DateTime | Requires both date and time. | Display statistics for 07/04/2000 between 1:00pm-2:00pm. |
Number | Requires a numeric value. | Enter the customer identification number. |
String | Requires a text answer. | Enter the region. |
Time | Requires an answer using a time format. | Display the total number of calls from 1:00pm-2:00pm. |
Designing Parameter Fields | Incorporating Parameters into Formulas