Crystal Reports 10: The Complete Reference
Probably the most common use for a parameter field is in report record selection. By creating a parameter field and using it with the Select Expert or a record-selection formula, you can prompt the viewer to provide variable information when the report runs, and have the report record selection reflect the viewer s choices.
After creating the desired parameter fields, use the toolbar button or pull-down menu option to display the Select Expert. Add a selection tab for the database field you want to compare to the value the viewer enters into the parameter field. In the operation drop-down list, choose the appropriate operation for the parameter action you need, such as is equal to for a region selection parameter, greater than for an order threshold parameter, or is like for a string-matching name parameter. Keep in mind that you may need to use a different Select Expert operation with parameter fields than you would otherwise . You ll typically use is equal to even if you want to allow multiple values or range values to be supplied by a parameter (not is between or is one of ). When you choose the drop-down list to see sample database values, you ll see parameter fields of the same data type in the list. Choose the correct parameter field.
Caution | Only parameter fields of the same data type as the database field will show up in the Select Expert. If you don t see the parameter field you expect in the Select Expert, it wasn t created with the same data type as the database field you are using. Change the value type of the parameter field and rerun the Select Expert. |
If you use the Formula Editor to edit the record-selection formula, you ll see all parameter fields (regardless of data type) in the Field Tree box. Choose the parameter field you want to use in the record-selection formula. The formula may look something like this:
{Customer.Region} = {?Region}
Make sure you choose a parameter field of the same data type, or use functions to convert the parameter field to the correct data type. If you try, for example, to compare a numeric parameter field to a string database field, you ll receive an error in the Formula Editor.