Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Date range values Post Reply Post New Topic
Author Message
lonh
Newbie
Newbie
Avatar

Joined: 08 Jul 2013
Location: United States
Online Status: Offline
Posts: 11
Quote lonh Replybullet Topic: Date range values
     Posted: 06 Aug 2013 at 11:54pm
I am new to CR. I am wanting to setup a report that ask for user to enter a beginning and ending date to retrieve records with in the specified date range.

thanks
poppy
Poppy Lon
IP IP Logged
praveeng
Senior Member
Senior Member
Avatar

Joined: 11 Jul 2011
Online Status: Offline
Posts: 165
Quote praveeng Replybullet Posted: 07 Aug 2013 at 12:45am
Hi,
 
If you need to return data based on a date range selected.  That's easy enought to put in... you just create a new Parameter field, set the type to "Date" and make sure the "Allow range vales" option is set to true.  With the parameter field created, you need to add a record selection formula that reads like this...
 
(TABLENAME.DATEFIELD) = {?DateRange Parameter)
 
...and all the records returned will be in that date range.
If you also need to display that range value in the report, which took a little digging to figure out.  All you need to do is to create a Formula field with the following code:

WhilePrintingRecords;
DateTimeVar date1;
DateTimeVar date2;
date1:=Minimum({?DateRange Parameter});
date2:=Maximum({?DateRange Parameter});
totext(Date(date1)) + " and " + totext(Date(date2))
 
 Then all you need to do is slap that formula field somewhere on the report, and it will display the date range selected in the parameter.
 
HTH
 
--Praveen G
Praveen Guntuka,
praveen_guntuka@yahoo.com
IP IP Logged
praveeng
Senior Member
Senior Member
Avatar

Joined: 11 Jul 2011
Online Status: Offline
Posts: 165
Quote praveeng Replybullet Posted: 07 Aug 2013 at 12:46am
Praveen Guntuka,
praveen_guntuka@yahoo.com
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