Crystal reports 10

Using Crystal Reports 10. ODBC connection to database.

My existing report has a Record Selector - {Quote Arrival Date} in (?StartDate) to (?EndDate).
This provides the user a start date & end date selector to create reports for all quotes within the nominated date period.

I need to change the report so the user can either print the report for a single quote or can print all quotes within a given date range.

So that is choose to print a single quote & add quote number OR choose a date range.  

I've tried a selector parameter - thinking it would eliminate the date range if selected.

 Record selection formula:


 if {?Selector} = "Single Quote" then
 {?QUOTE} = {QUOTE.QUOTE#}
else
 {QUOTE.ARRIVAL_DATE} in {?Start Date} to {?End Date}
 
The issue is now the report displays all parameters - start date, end date, selector and quote. The date range shouldn't be included at all if the quote number is nominated.  {?Quote} is a parameter number type else I was getting an error.

Crystal is also enforcing a number to be entered for the quote parameter. This field should be null unless selector parameter single quote selected and a quote number is entered.

I tried this formula - but simply removes the selector parameter and enforces a quote number to be applied.

 if isnull({?QUOTE}) then
 {QUOTE.ARRIVAL_DATE} in {?Start Date} to {?End Date}
 else
 {?QUOTE} = {QUOTE.QUOTE#}

I've even tried having a default value of 0 for the Quote# but then crystal wont allow null values for the start and end dates.

Super frustrating!

If possible I'd like to show the selector and then once option selected e.g. single quote the quote number entry field is displayed. Alternatively if date range is selected then the start and end date fields are displayed.

It seems silly that the report is exactly the same only the record selector is different for each.
Murphy1992Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
How about providing default dates for the date parameters.  Say 1 Jan 1900 for the start date and 31 Dec 2099 for the end date.

You could then test for those dates and not show the parameter values.

CR 2008 added the capability for OPTIONAL parameters.  If you can upgrade to it, you could use that feature.

mlmcc
0
Murphy1992Author Commented:
I've requested that this question be deleted for the following reason:

No viable solutions offered
0
mlmccCommented:
What was not viable about my solution.  Before closing this you really should respond and start a dialog.

My solution will work.  If you need help implementing it just ask.

mlmcc
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

mlmccCommented:
Here is a sample filter that should work

(
{?Start Date} = Date(1900,1,1) OR
  {QUOTE.ARRIVAL_DATE} in {?Start Date} to {?End Date}
)
 AND
(
  {?QUOTE} = 0
  OR
  {?QUOTE} = {QUOTE.QUOTE#}
)

Another way it could work would be

If {?Start Date} = Date(1900,1,1) then
     {?QUOTE} = {QUOTE.QUOTE#}
Else
     {QUOTE.ARRIVAL_DATE} in {?Start Date} to {?End Date}

mlmcc
0
Murphy1992Author Commented:
Thanks.

Tried in Crystal 2011 & to be honest think the issue is how Crystal processes.

It either renders report without any data or enforces data into parameters.

I've tried your suggestion and a couple of other derivations but it simply wont do the date range OR the single quote.

Tried with a default estimate value or with 0, with null value etc  and the crystal processes all the same way.

e.g.1
{QUOTE.ARRIVAL_DATE} in {?Start Date} to {?End Date}
and
if {?QUOTE} < 99999 then {QUOTE.QUOTE#} = {?QUOTE}
else
{QUOTE.ARRIVAL_DATE} in {?Start Date} to {?End Date}

e.g.2
(
(not HasValue({?QUOTE}) and {QUOTE.ARRIVAL_DATE} in {?Start Date} to {?End Date})
or
(HasValue({?QUOTE}) and {QUOTE.QUOTE#} = {?QUOTE})
)


Thanks very much for taking time to look at but just think this is a processing issue and will have to keep as two separate reports.
0
Murphy1992Author Commented:
Attached a copy in 2011 with data saved with report in case I'm missing something
Sample---Date-Range-vs-Single-Est.rpt
0
mlmccCommented:
IN the report you didn't make the parameters optional so they required values.

If you can guarantee either there will be a value in QUOTE or in both start and end date you can use

(
 (HasValue({?QUOTE}) and {QUOTE.QUOTE#} = {?QUOTE})
 or
 (HasValue({?Start Date}) and {QUOTE.ARRIVAL_DATE} in {?Start Date} to {?End Date})
)

If you can't guarantee both start and end date will have a value or quote will have a value
(
 (HasValue({?QUOTE}) and {QUOTE.QUOTE#} = {?QUOTE})
 or
 (HasValue({?Start Date}) and {QUOTE.ARRIVAL_DATE} >= {?Start Date})
 or
 (HasValue({?End Date}) and {QUOTE.ARRIVAL_DATE} <= {?End Date})
)


Once I changed the parameters to optional it required access to the database.

I also created a version using the default values I suggested and the selector parameter.

If {?Selector} = "Single Quote" then
    {QUOTE.QUOTE#} = {?QUOTE}
Else
    {QUOTE.ARRIVAL_DATE} in {?Start Date} to {?End Date}


mlmcc
Sample---Date-Range-vs-Single-Est-se.rpt
Sample---Date-Range-vs-Single-Est-op.rpt
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Murphy1992Author Commented:
AWESOME!!!!

I completely missed the "optional parameter" function in parameter value options!  My apologies!  Clearly couldn't see wood for trees!

Works a treat now!
0
Murphy1992Author Commented:
Expert went over and above to help resolve issue
0
Murphy1992Author Commented:
Expert when over and above to help resolve!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.