Click here to Skip to main content
11,704,509 members (60,158 online)
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 10:20am
Edited 10-Nov-11 3: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 Sergey Alexandrovich Kryukov 738
1 OriginalGriff 495
2 Andy Lanng 275
3 CPallini 242
4 Maciej Los 235
0 OriginalGriff 8,824
1 Sergey Alexandrovich Kryukov 8,247
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,606

Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 11 Nov 2011
Copyright © CodeProject, 1999-2015
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