Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
I am trying to learn how to use Crystal Reports and I have set up a parameter in my report to allow multiple values. This works well except that it prompts the user to enter a value or values when I run the report. What I would really like is for the default action to be all values are displayed with no user prompt. If he wants to filter to a subset then he can. I have searched but can not seem to find how to do this anywhere.
Thanks in advance for any advice,
Surely there is a way to programatically set the value of the multi-parameter to all?
Posted 9-Nov-11 11:20am
Edited 10-Nov-11 4:59am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

With Crystal Report, you can pass the parameter via code (bypassing the Crystal Report UI to input parameters). This looks to be what you are trying to accomplish:
VS 2010 - Passing Parameter Programatically to Crystal reports[^]
The other option would be to create your own UI and then pass the selected values to the report using either a selection formula or parameters.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

After a lot more digging and experimentation I found the pieces of the puzzle I needed to make the report behave like I wanted. Here are the key pieces. To set the parameter value programatically you do the following.
rpt.SetParameterValue("parm", "*");
Then in the Crystal Reports menu select Report->Selection Formula->Saved Data...
add the following formula
if HasValue({?parm}) Then
    if {?parm} = "*" Then
        {?parm} = {Table.FieldEquatedToParm}
This will allow the report to come and display all the values without prompting the user to enter a value. Then if the user decides they want to filter the report they can use the parameter panel to choose a filter value. The formula get kind of nasty if increase the number of filterable columns though.
RaisKazi at 11-Nov-11 13:17pm
Edited: Formatted with "code" and "pre" tags.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 280
1 Sergey Alexandrovich Kryukov 279
2 CPallini 205
3 Maciej Los 197
4 Afzaal Ahmad Zeeshan 160
0 OriginalGriff 5,635
1 DamithSL 4,496
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180

Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 11 Nov 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100