Please refer to How to create a parameter field in Crystal Reports version XI (BB721055) if you are using version XI.


Establishing a Parameter Field
  1. Select Insert > Field Object from the menu bar.
 
  • The Field Explorer dialog box appears.
 
  • Right-click on Parameter fields and select New

    Field Explorer dialog box

  • The Create Parameter Field dialog box appears:

    Create Parameter Field dialog box

  • Enter a name for the parameter field.
 
  • Enter the Prompting text, which is a text message that will indicate what you should do or select (for example, "Enter the subheading for the report" or "Enter Start Date").
 
  • Select the value type. The options are (examples of each type are shown in parenthesis):
    • Boolean (True or False)
    • Currency ($534.12)
    • Date (03/15/2002)
    • DateTime (03/15/2002 2:49:09PM)
    • Number (12345)
    • String (text)
    • Time (2:49:09PM)

    Note: If you are using an existing field (such as gift date) as the parameter and you do not know the value type, select a logical value type for the field (for example, for a date field, try DateTime). Continue with step 6 and select the appropriate table in the Browse table drop-down menu. If the appropriate field does not display, click Cancel and enter another value type. Click Set Default Values and repeat steps d and e. If not, repeat this process until the field displays.
     
  • In the Options frame, set the parameter to accept discrete values, range of values, or both. By toggling on the Discrete value(s) option button, you can select only discrete, or singular, values for your parameter field. If you have Allow multiple values toggled on, you will be able to select more than one discrete value for your parameter field.
     
  • If applicable, click Set default values. This option allows you to limit the options accessible to other users, which can help prevent data entry error. If you click this button, the following screen appears:

    Set default values
     

  • On the Set Default Values screen, you can either select multiple values from a database table or enter unique values. For example, a parameter used to select certain Projects could use the Project IDs from a table.
  • Click OK to return to the previous screen.

  • Click OK to save the parameter field.


Using Parameters in a Report

Once you establish a parameter, you can use it in a formula, selection formula, or on the report as a field.
 
  • Formula - The formula below displays the transaction amount only if the transaction's posting date is between the Beginning Post Date parameter and the Ending Post Date parameter.

    If {TRANSACTION.EN_US} in [{?Beginning Post Date} to {?Ending Post Date}] Then {TRANSACTION.EN_US}

    Select to either preview the report or refresh the data and a prompt appears to enter a beginning post date and an ending posting date.
 
  • Selection - You can use a parameter to filter the data by using it in the Select Expert. This allows you to create separate reports using the same database. For example, you could use a parameter to create a report that requires different customers each time.
    1. Open the Select Expert (BB11252)
    2. Click New
    3. Select the field to use for the parameter
    4. Select the "is equal to" operator
    5. Select the parameter field from the drop down
    6. Click OK
    Select Expert
 
  • Report Field - You can also use parameters as report fields. For example, you may need to enter a different sub-heading each time you run a particular report. Instead of changing a text box each time, you could create a string parameter. If you use this option, each time you preview the report or refresh the data, a parameter screen appears prompting you to enter a new sub-heading.


Take the RE7 Graduate Track: Custom Reporting class at Blackbaud University for an in-depth look at this process.