Print Page | Close Window

selecting all values in dynamic parameter

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=9897
Printed Date: 02 May 2024 at 8:22am


Topic: selecting all values in dynamic parameter
Posted By: Nissim
Subject: selecting all values in dynamic parameter
Date Posted: 04 May 2010 at 10:30pm
Hi everybody,
I breaking my brain to find a solution for displaying the word "ALL" when the user selects all values in a dynamic parameter with multiple values option.
I don't want to add the 'ALL' value to the selection because the user can still click on the ">>" button and select all values and not the "All" value I added.
I thought to compare the count of the two boxes - "Available Values" and "Selected Values" and if they are equal then return "ALL" in the formula, but I don't know how to get the count from the "Available Values" box.
any ideas?



Replies:
Posted By: lockwelle
Date Posted: 05 May 2010 at 3:17am
How is the dynamic parameter options supplied?  You should be able to count the entries in the table and compare that to the length of the array of items selected...unless there are more than a 1000. I've heard that CR has a limit, but since I don't use the parameter screen (custom parameter wizards instead), I don't really know/care.
 
Personally, listing that many options is too hard on the user.
 
HTH


Posted By: DBlank
Date Posted: 05 May 2010 at 3:27am
Another option is to use a crystal command as a Union with the text '...All' into the param source field then use the command field as your source instead.
Your seelct statment wil then be
{?param}='...All' or {?Param}=command.field


Posted By: DBlank
Date Posted: 05 May 2010 at 3:28am
Note: I have found Commands to drag the performance at my site. You can also do this via a stored proc which may be more efficient.


Posted By: Nissim
Date Posted: 05 May 2010 at 3:42am
Originally posted by DBlank

Note: I have found Commands to drag the performance at my site. You can also do this via a stored proc which may be more efficient.

This is a nice solution, but, what if the user ignores the additional option of "All" and selects all values by clicking the ">>" button?
Then the selection will look like this:
All
value1
value2
value3
......
.....


Posted By: lockwelle
Date Posted: 05 May 2010 at 3:43am
I would have offered the suggesting, but he stated that he didn't want an ALL option.  Personally, I would have created the command.
 
Since we use custom designed/coded wizards, all of my options have an ALL.


Posted By: lockwelle
Date Posted: 05 May 2010 at 3:45am
So, check if the 'ALL' option is in the array first, and if it is, you're done, no filtering needs to take place.  If they select everything except ALL (and why would they do that??) you can check the other way...or not bother as they made the deliberate decision to click everything except the ALL.
 
 


Posted By: DBlank
Date Posted: 05 May 2010 at 3:53am
agreed with lockwelle.
{?param}='...All' or {?Param}=command.field
if the user select the 'all' option it will override the rest of the select otpions and return all records regardless of what else they select.


Posted By: Nissim
Date Posted: 05 May 2010 at 4:20am
OK. seems good solution to me.
what if the value is numeric? All will be present by number, 999, for example?
I have another question if you don't mind. In case the multiple value is numeric, and it has also Description. Now I want to present the user his selection in the report header with words (description). Is there an easy way to do this?
I usually create a subreport that retrieves the descriptions from the database (again) and link it with the id (numeric values).


Posted By: DBlank
Date Posted: 05 May 2010 at 4:55am

You have to determine which to use for a number 0 or 999.

{?param}=0  or {?Param}=command.numberfield
 
although I am confused as to why you would want to make a user select a number field when you have the description available and can use it in a dynamic param and include the '..all' option. Usually end users can manage descriptions much better than a reference code #.
If you use a number you can use an array to convert it to text and display that.
if you use the text fieldyou can just join the param field and dispaly that.
join(?{textparam},',')



Print Page | Close Window