Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: How to Implement default Value ALL in prompt Post Reply Post New Topic
Author Message
ishu1404
Newbie
Newbie


Joined: 03 Jan 2011
Location: India
Online Status: Offline
Posts: 12
Quote ishu1404 Replybullet Topic: How to Implement default Value ALL in prompt
     Posted: 03 Jan 2011 at 9:05pm
PostPosted: 03 Jan 2011 06:49 
Post subject: Re: How to Implement default Value ALL in prompt
Reply%20with%20quoteEdit/Delete%20this%20post

hi,
I am working on Crystal reports 12.1 and
i am using the Universe.

The requirement is like if user selects "ALL" all currency data should be displayed.

Now if am creating a prompt in the query panel and giving the formula
(if {?Currency Prompt} = "ALL" then true
else ({MM_query.Currency}={?Currency Prompt}))
in the record selection formula then for Default value ALL its not fetching any data.

But if i am creating the Prompt as Parameter Field at the report level and giving the same formula(changing the prompt name accordingly) then the report is fetching data for default value ALL.

The only problem in creating the Report level prompt is that i have to hardcode all the currency values which can change in the future so i have to get the list of values from the database itself and i think for that i need to create prompt in the Query panel only.

Please help...
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 04 Jan 2011 at 3:34am
You don't need the "If...Then" syntax.  Try this instead:
 
({?Currency Prompt} = "ALL" or
 {MM_query.Currency} = {?Currency Prompt})
 
Note the parentheses at the beginning and ending of this (in red) - if you have other conditions in your record selection criteria, you MUST include these in order for it to work correctly.
 
-Dell
IP IP Logged
yourajai
Newbie
Newbie
Avatar

Joined: 13 Jul 2012
Location: India
Online Status: Offline
Posts: 5
Quote yourajai Replybullet Posted: 21 Aug 2012 at 10:40pm
Hi,
 
It will work as long as no new field coming into DB.
If new field coming into DB what is the way?
 
Please suggest.
Regards,
Ajai Mathew
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 22 Aug 2012 at 3:23am
Go to the Database menu and select "Verify Database".  This will look for new fields in the tables used in your report.
 
-Dell
IP IP Logged
yourajai
Newbie
Newbie
Avatar

Joined: 13 Jul 2012
Location: India
Online Status: Offline
Posts: 5
Quote yourajai Replybullet Posted: 22 Aug 2012 at 3:42am
Thanks Hilfy.
 
But my doubt is given below,
 
My Table looks like below
City   --   Revenue
---------- -------------
NewYork -- 1000
California --500
 
I have created a prompt for CITY by LOV's. When I refersh the report it shows (.... Newyork, California).
But i would like to see ALL instead of (.... )
what is the procedure to put "ALL" as a prompt in crystal report.
 
 
 
 
 


Edited by yourajai - 22 Aug 2012 at 3:42am
Regards,
Ajai Mathew
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 22 Aug 2012 at 5:23am
You'll actually run the LOV for the prompt off of a separate command instead of off the data in the report.  You'll do something like this:
 
(Select "*All" as City_Name from Dual
 
UNION ALL
 
Select City_Name from Cities)
order by City_Name
 
NOTE:  The "from Dual" syntax is specific to Oracle, you'll need to replace with the correct syntax for your database.  Using "*All" instead of "All" will automatically sort *All to the top.
 
Don't link this command to anything in your report.  Crystal will complain about it, but it's ok.
 
-Dell
 
IP IP Logged
yourajai
Newbie
Newbie
Avatar

Joined: 13 Jul 2012
Location: India
Online Status: Offline
Posts: 5
Quote yourajai Replybullet Posted: 22 Aug 2012 at 6:45pm
Thank you Hilfy :)
 
It is working.


Edited by yourajai - 22 Aug 2012 at 6:45pm
Regards,
Ajai Mathew
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum