BOFocus – Crystal Reports Tips – Tricks – Tutorials

Crystal Reports - Design

Assign a default value or add another value to a dynamic parameter

Crystal Reports – Dynamic Parameters aren’t very dynamic
By design, you can cannot assign a default value or add another value to a dynamic parameter within Crystal Reports. If you are you customer wants the parameter to have an ‘ALL’ options, you’ll need to create a command.

1) Open a new Crystal Report and select your data source
2) Click on Add Command

3) Use the following example to create your command:

SELECT ‘ALL’ as Country FROM Customer UNION SELECT DISTINCT Country FROM Customer WHERE NOT (Country LIKE ‘N*’ OR Country LIKE ‘B*’)
NOTE: Within my statement, I included WHERE NOT to filter out any Countries that started with an N or B

4) Once you created your command, Insert the command into your report and do not link it to any other tables/views
5) Create a new parameter and select Dynamic, select your {command.field} from the from the field list under “Command” and click on “Click to Create Parameter.

6) Be sure to set all Options (allow multiple values, allow range values, etc) for desired effect.
7) Insert your parameter into your report and refresh to ensure your parameter includes ‘ALL’:

Tagged , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



Reports should usually be grouped before sorting.