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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying the date range 1

Status
Not open for further replies.

QueSpr04

Programmer
Jun 3, 2004
50
US
I am using CR10 and I am having trouble displaying a date that lands on a weekend, ie. Saturday or Sunday. I have stated the date range in a formula that looks likes this "Minimum ({tablename.date}" and "Maximum ({tablename.date})." It in return displays the date on the report as such February 2, 2004 to February 27, 2004, when I need the entire month of February from the 1st to the 29th and it is only grabbing the dates that are from weekdays. How can I get the program to display the dates from the 1st to the 29th instead of the 2nd to the 27th? Please help. Any suggestions?
 
With the formula you have, you will ONLY get the dates that have data.

If you always want the display first and last day of the month based on {tablename.date}, then

//For the first day of the month
dateserial(year({tablename.date},month({tablename.date}),1)

//For the last day of the month
dateserial(year({tablename.date}),month({tablename.date})+1,1-1)

 
The reason it's grabbing the dates for the weekdays is because that's the only data you have in your database, so a minimum and maximum will produce exactly what you asked it to.

If you're using parameters to obtain the date range, display the parameter range the same way to accomplish this:

totext(Minimum ({?dateparm}))+" and "+ totext(Maximum ({?dateparm}))

If not, you'll need something to derive the dates:

whileprintingrecords;
datevar MinDate := minimum({table.date});
datevar MaxDate := maximum({table.date});
MinDate := cdate(Year(Mindate),Month(Mindate),1);
MaxDate := dateadd("m",1,Mindate)-1;
totext(Mindate)+" to "+totext(MaxDate)

-k

 
Thanx Guys!!!!! These tips were right ontime!!! Thanx again and I'll be logging on everyday and hopefully I could help you guys out one day!
 
Thanx Witchitakid and synapsevampire!!!!! These tips were right ontime!!! Thanx again and I'll be logging on everyday and hopefully I could help you guys out one day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top