views:

39

answers:

3

Hi, I have dropdown parameter with multi-values allowed. In my report header I want to show all the dropdown values that were checked by the user to run the report. But since there could be a couple of hundred values I want to show 'ALL' when all the values are selected instead of listing them one by one. How can I do that?

Thanks,

+1  A: 

Maybe you could feed the results into a subreport which would count the total # of values available vs selected. If they are equal, then it would return "All".

PowerUser
+1 - That was the only thing I could come up with either. It seems Crystal Report (or at least the versions I've played with) don't have a way of calculating the maximum number of options.
LittleBobbyTables
A: 

If this is a static list, you can do something like this :

If UBound({?MyParameter}) = @ValueCount Then 'All' Else Join({?MyParameter}, ', ')

where @ValueCount is the number of possible values for the parameter.

If the number of possible parameters is varying between executions, then PowerUser's subreport method is one option.

CodeByMoonlight
A: 

You can do this if you read the list of parameter values from the database, you can then use a query to get the number of options.

Edit the parameter, set "List of Values" = Dynamic

Add a Command in the Database Expert to get your option count, something like:

SELECT COUNT(DISTINCT option) optCount FROM optTable

Then, building on CodeByMoonlight's suggestion, use a formula:

If UBound({?MyParameter}) = {Command.optCount} THEN "ALL"
ELSE Join({?MyParameter}, ', ')
tequila2k