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!

Use "ALL" or specific id in a parameter 1

Status
Not open for further replies.

blueboyz

Technical User
Sep 13, 2005
210
US
Using Crystal Reports 2008

I am creating a report to list the items sold to customers for a specific date range.

Customer Item Invoice # Qty Amount
AVERY A 221 11 200.00
B 245 10 100.00
Total for Customer AVERY 21 300.00

CLAYTON B 222 5 50.00
C 255 10 500.00
J 232 10 800.00
Total for Customer CLAYTON 25 1350.00

I need help creating a parameter and/or formula to have a user be prompted to enter a specific customer id or display all customer id's on the report.

I tried changing the parameter option for Optional Parameter from False to True, but if the user does not enter any customer id, nothing is displayed on the report. I also tried adding "ALL" to the customer id vaules, but selecting ALL (with the selection formula (If {customers.customerid} = "ALL" then TRUE else {customers.customerid} = {?customer}) did not display any customers on the report.

I was able to use "ALL" in previous versions of crystal but crystal 2008 doesn't seem to work. I'm sure I am not understanding the new parameter functionality, but the documentation is not clear enough for me to understand how to create a parameter correctly.

Any help is greatly appreciated.

 
Hi,
Slight revising should make it work:
Code:
If [COLOR=red]{?customer} [/color] = "ALL" 
then TRUE 
else
 {customers.customerid} = {?customer}

You need to use the parameter not the field to test for ALL



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thank you. That worked when I enter "ALL" as the specific customer id in the parameter field.

Do you know how to use the "Optional Prompt" in the Value Options: box of the parameter? I thought if a user did not enter any values and the "Optional Prompt" was set to TRUE then crystal is supposed to assume "ALL". However, when I skip the customer id parameter, I receive an error message: Parameter has no value and crystal displays the formula workshop highlighting the parameter field in the selection formula If {?Customer} = "ALL" then TRUE else {Customers.CustomerID} = {?Customer}.

Another way to put it, what is the correct way to add "ALL" as the default value for the parameter? I tried setting the "Optional Prompt" to TRUE and the Default Value to ALL, but when I run the report and skip the {?Customer} parameter, I get the error message: Parameter has no value.



 
Hi,
That feature is new to CR2008 so I never used it...Sorry..

I would just leave the parameter mandatory but have ALL as the default value ( in previous versions you could specify a default value for a parameter, and allow the user to change it, not sure about CR2008)..



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
There was an item on the Optional Parameters in the recent edition of Crystal Clear. it will be up on our web site later today.

The record selection formula looks like...
not HasValue ({?Country}) or
{Customer.Country}={?Country}




Editor and Publisher of Crystal Clear
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top