Link to home
Start Free TrialLog in
Avatar of sapgonzalez
sapgonzalez

asked on

How do I print date range selected in Crystal Report 8.5 Select Expert

I am trying to print the date range selected in Select Expert in my Report Heading.  I placed the database fields in the Report Header, but it does not display the range I selected. The report results are accurate for the date range I selected.
Avatar of LinInDenver
LinInDenver
Flag of United States of America image

If you did a date range parameter (allow range)

try

Minimum( {?DateRangeParam} ) & ' to ' & Maximum( {?DateRangeParam} )
Avatar of sapgonzalez
sapgonzalez

ASKER

I just set up parameters and I can get the date range to print correctly in report title, but the date range does not match the dates used in Report Select.  I modified the formula as follows:

{periodt.pebedt} >= DateTime (?Begin Date) and
{periodt.peendt} <= DateTime (?End Date)

I would like to be able to use this link between parameter and table.field.  Is this possible?
can you show me what your original formula looked like (that returned the data the way you wanted)? two date fields can be tricky!
{periodt.peendt} <= DateTime (2009, 12, 31, 00, 00, 00) and
{periodt.pebedt} >= DateTime (2008, 01, 01, 00, 00, 00)
Thanks!
Does this fix it?

date({periodt.pebedt}) >= Date (?Begin Date) and
date({periodt.peendt}) <= Date (?End Date)

If your periods are always at "midnight" convert both to dates instead of datetime for your comparison.
I need to link parameters ?Begin Date to periodt.pebedt and ?End Date to periodt.peendt - is there a way to do this in Crystal?
Does that mean my last post didn't work? If not, I'm not sure how your original formula was working.

I believe the only way to do this is through your join (your select expert).

if you were to link them it would make the select expert this way - equal instead of >= <=

date({periodt.pebedt}) = Date (?Begin Date) and
date({periodt.peendt}) = Date (?End Date)
When I use this format
date({periodt.pebedt}) = Date (?Begin Date) and
date({periodt.peendt}) = Date (?End Date)

I receive error message, "The ) is missing".  I have tried placing ")" at end and I still receive error message.
if you just typed in ?Begin Date, it won't work. it needs to have brackets (this makes it an actual report field and not just text).

i still believe this is the code you need to use (with the >= and <= )

date( {periodt.pebedt} ) >= Date ( {?Begin Date} )  
and
date( {periodt.peendt} ) <=  Date ( {?End Date} )
Now, I receive a "A date-time is required here." error message.
ASKER CERTIFIED SOLUTION
Avatar of LinInDenver
LinInDenver
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Option # 2 worked - wow, thank you very much for your patience and hard work!
Very patient and dedicated to helping me find a solution.
no problem. glad we cracked the code. ;-)