Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem selecting all users on a parameter 1

Status
Not open for further replies.

Jonesxx

Technical User
Jul 14, 2004
71
GB
Hi,

I'm using Crystal 8.5, I have put a parameter on the report where user names can be selected. The drop down list shows the individual user names, however I also want to have an option where all users can be selected without having to click on the individual names. In the Parameter I entered a blank (thinking this would bring back all users), however when selecting the blank the ADD option is inactive and all user names do not come back.

Any ideas?

Thank you v m
 
You can add an extra item in your Users list such as "All" and in your record selection formula write something like this;

if {?Users} <> "All" then
{yourusernamefield} = {?Users}


You don't need to add an else to this if statement, as it will only be evaluated if "All" is not selected. If it is selected then the user parameter is not used to filter the data.
 
Hi BobHuk

Do you know the exact syntax as when I write what you say, I get a message saying that the keyword 'then' is missing, even though 'then' is already within the syntax?

Thanks
 
BobHuk: You'll find that in older versions of Crystal this solution (your example is what is stated in the BO whitepaper) may not pass the criteria to the database.

I tend to suggest:

(
if {?Users} <> "All" then
{yourusernamefield} = {?Users}
else if {?Users} = "All" then
true
)

This has the highest sql pass through rate, but it isn't bulletproof either.

Jonesxx: Make sure that it passes to the database by using the Database->Show SQL Query, and check out my faq for some advanced record selection formulas:

faq767-3825

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top