In cases where users would like the option to filter a report, such as by Account Representative, but do not always want the filter to be used, you can use two available options:
Using the Crystal Prompts
If you are not using any Special Lookup fields, you can forgo using the Custom Dialog screen and have your users fill in the Crystal Report prompts instead. Any Active Parameters (e.g. @Event, @Organization) will be filled in by the software and your users will be prompted to enter any remaining values. You may also choose to set the Optional Prompt value of the parameter as True, and users will be able to skip filling in the parameter if desired. When using the Select Expert to filter by an Optional parameter, Crystal reports will automatically update the selection criteria to handle the empty parameter. If you prefer to use the Selection Formulas, you must add "OR IsEmpty({Parameter}) to the selection. For example ({EV200_EVT_MASTER.EV200_EVT_START_DATE = {?StartDate} OR IsEmpty{?StartDate}). It is important to wrap the statement in parentheses so it is processed together.
Providing a Default Value
If the report is using a Special Lookup field, you are required to use the Custom Dialog screen for your report to properly provide those values. The Custom Dialog screen does not allow for empty parameters to be passed to the report, so you must provide a default value. It is best to notify your users what this value is in the prompt (e.g. "Select Event (-1 for all)"). For any numeric values, use -1 as the default value. For text values, something distinctive is needed like "*ALL". Then in the selection formula, you need to account for the default value. For example ({EV200.EVT_MASTER.EV200_COORD1} = {?%SalesRepAccount} OR {?%SalesRepAccount} ='*ALL"). It is important to wrap the statement in parentheses so it is processed together.
Using optional parameters can provide more customized reports for your users without requiring the maintenance of multiple report versions.
Comments
0 comments
Please sign in to leave a comment.