|
|||||||||
|
Crystal Reports Tools: Improve Performance While Saving Time and Money |
|
Crystal Reports: Display the Complete Month in a CalendarOne way calendars appear when there are five weeks needed is to display the last two days of the month on the first line of the calendar. First you will need to change the conditional display string of the Sunday on the first row to
Then change the conditional font color to
You need to change the first two running total fields. The conditional evaluate of the First Sunday is
Do a similar change to the First Monday in your calendar. As the month can only wrap two days in the top row, you dont need to make any changes further along the row.
Another issue in month calculations is calculating the month values. We developed a series of useful formulas for month calculations. Use this one to first calculate the last day of the month: Local numbervar m:=month(CurrentDate) + 1; Local numbervar y:=year(CurrentDate); If m>12 then (m:=m-12; y:=y + 1); Date(y,m,1)-1; Once you have that formula, then it is quite easy to calculate the number of days in the month Day({@LastDayofMonth) From there, the Last Friday of the month is calculated as follows. If DayofWeek({@lastDayofMonth}) >=6 then // Friday or Saturday Then {@LastDayofMonth) DayofWeek({@lastdayofmonth}) + 6 Else {@LastDayofMonth) DayofWeek({@lastdayofmonth}) 1 If you require a different last day of the month, create a variation of the formula below. This example calculates the Last Wednesday of this Month If DayofWeek({@lastDayofMonth}) >=4 then // Friday or Saturday Then {@LastDayofMonth) DayofWeek({@lastdayofmonth}) + 4 Else {@LastDayofMonth) DayofWeek({@lastdayofmonth}) 3 Use these directly with your database fields or modify the formulas to make them a custom function (version 9 and above).
This article is copyrighted by Crystalkeen, Mindconnection, and Chelsea Technologies Ltd. It may be freely copied and distributed as long as the original copyright is displayed and no modifications are made to this material. Extracts are permitted. The names Crystal Reports and Seagate Info are trademarks owned by Business Objects. |