Posting Yak Master
Posted - 11/09/2006 : 09:48:30
| Hello Everyone,
I do not see the forum for Reporting Services, so I will post this here for now. I have a VB Script that I would like to use as a Function to return the Weekday Name for me in Reporting Services.
Function rDateTime(rDate, rTime)
DIM myDay, myDayName, myMonthName , myYear, myTime
DIM myAMPM, myHour, myColon, myMinute
'get AM or PM from the time
myAMPM = Right(rTime,2)
'get Hour and Minute
myColon = instr(1, rTime, ":",vbBinaryCompare)
IF myColon = 2 THEN
myHour = Left(rTime,1)
myMinute = Mid(rTime, 3, 2)
myHour = Left(rTime,2)
myMinute = Mid(rTime, 4, 2)
'concatenate the time
myTime = myHour & ":" & myMinute & " " & myAMPM
'get weekday number
myDayName = weekday(rDate)
'convert weekday number to weekday name
myDayName = weekdayname(myDayName)
'get the day, e.g. oct 19, 2002, will return 19
myDay = Day(rDate)
'get month number
myMonthName = Month(rDate)
'convert month number to month name (abbreviation True)
myMonthName = MonthName(myMonthName, True)
'get the year
myYear = Year(rDate)
rDateTime = myDayName & myMonthName & ". " & myDay & ", " & myYear & myTime"
How should I use this as a funciton in SQL Server Reporting Services? I think that I need to use a calculated field. Am I correct or what do I need to do to implment this. This code will return the Weekday Name which is what I need.
TIA for any help in advance.
Have a great day!