how to design calendar in reporting service.
Dear allI want to design calendar in report. in report parameterthere will be date rangee.g.From: 15/01/2009To: 15/03/2009there should be design 3 complete months (January, February,March(these are reporting params) ) per page as a calendar. How can i design??
March 24th, 2009 11:06am

Hi, You need to create the calendar in database and then use a matrix in the report. Here is the step: 1 Create the calendar in database: CREATETABLEdbo.calendar( the_datedatetimeNOTNULL ) GO ALTERTABLEdbo.calendar ADD CONSTRAINTpk_calendarPRIMARYKEYCLUSTERED(the_date) WITHFILLFACTOR=100 GO INSERTINTOdbo.calendar(the_date) SELECTthe_date FROM( SELECTDateAdd(dd,(a.number*256)+b.number,0)As[the_date] FROM( SELECTnumber FROMmaster..spt_values WHEREtype='P' ANDnumber<=255 )As[a] CROSS JOIN( SELECTnumber FROMmaster..spt_values WHEREtype='P' ANDnumber<=255 )As[b] )As[dates] GO 2 Create a report with two parameters @start and @end, and then use the following code as dataset query string: SELECTthe_date ,DateName(dw,the_date)asweek ,DatePart(wk,the_date)asWeek_Number_Of_Year ,month(the_date)Asmonth ,YEAR(the_date)asYear ,Row_Number()OVER(ORDERBYthe_date)Asid ,CASE WHENDateName(dw,the_date)='Monday'THEN1 WHENDateName(dw,the_date)='Tuesday'THEN2 WHENDateName(dw,the_date)='Wednesday'THEN3 WHENDateName(dw,the_date)='Thursday'THEN4 WHENDateName(dw,the_date)='Friday'THEN5 WHENDateName(dw,the_date)='Saturday'THEN6 ELSE0ENDAsWeekNumber FROMdbo.calendar WHEREthe_date>=@startandthe_date<=@end 3 Create a matrix with two row group: RowGroup1 group on =Fields!month.Value and RowGroup2 group on =Fields!Week_Number_Of_Year.Value. One column group which group on =Fields!WeekNumber.Value. Edit the column group, set the group sorting by =Fields!WeekNumber.Value with direction Ascending. 4 Set the cell expression of RowGroup1 to be "=cstr(Fields!month.Value)+"/"+cstr(Fields!Year.Value); Set the cell expression of ColumnGroup1 to be =Fields!week.Value; Set the cell expression of data to be =format(Fields!the_date.Value,"dd"); 5 Edit the RowGroup1, set the page break at the end of this group. Please let me know if this helps. Raymond
Free Windows Admin Tool Kit Click here and download it now
March 26th, 2009 4:15am

I found this approach very useful, however, how can I combine this matrix to show tasks info as well. I have a table with tasks and their dates. Is there a way I can show inside the matrix the tasks that you are supposed to do on a particular day? Thanks in advance Rene Alvarez
April 29th, 2010 7:14pm

Does the above solution work in visual studios 2010 report designer. The dataset is created outside of report services.Will Beamon
Free Windows Admin Tool Kit Click here and download it now
July 24th, 2012 3:10pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics