Wednesday, March 7, 2012
Custom date format...
I'm just trying to get custom date formatting working. I have a datetime
variable plotted on an x axis of a scatter plot. The axis is marked as
continuous ('numeric of timescale values').
I'd like the time to appear as eg 'Jan 04' and thought this would be
possible based on the posting by Robert Bruckner in response to 'Custom Date
Format' (09/Apr) in which he said that one could use these functions
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomdatetimeformatstrings.asp
However I cannot get any of these codes to work. I have tried putting the
codes in or by putting the format code as this:
=Format(Fields!calDay, "MMM")
Woudl be very grateful if someone could tell me whether this is possible and
if so how I should go about it.
Thanks,
Phil
PS I don't want to convert to a string as I have lots of values and quite
like keeping it as a continuous axis.Pull up chart properties dialog, go to X-axis tab, check "Numeric and
Timescale Values" checkbox, check the "Show Labels" checkbox, and enter "MMM
yy" in the Format code textbox (without the double-quotes.)
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Phil Aldis" <PhilAldis@.discussions.microsoft.com> wrote in message
news:5D4AF02E-618F-4FAD-9E52-473A5EAFBB70@.microsoft.com...
> Hi,
> I'm just trying to get custom date formatting working. I have a datetime
> variable plotted on an x axis of a scatter plot. The axis is marked as
> continuous ('numeric of timescale values').
> I'd like the time to appear as eg 'Jan 04' and thought this would be
> possible based on the posting by Robert Bruckner in response to 'Custom
Date
> Format' (09/Apr) in which he said that one could use these functions:
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomdatetimeformatstrings.asp
> However I cannot get any of these codes to work. I have tried putting the
> codes in or by putting the format code as this:
> =Format(Fields!calDay, "MMM")
> Woudl be very grateful if someone could tell me whether this is possible
and
> if so how I should go about it.
> Thanks,
> Phil
> PS I don't want to convert to a string as I have lots of values and quite
> like keeping it as a continuous axis.
>
>
>|||Thanks - works perfectly.
Phil
"Ravi Mumulla (Microsoft)" wrote:
> Pull up chart properties dialog, go to X-axis tab, check "Numeric and
> Timescale Values" checkbox, check the "Show Labels" checkbox, and enter "MMM
> yy" in the Format code textbox (without the double-quotes.)
> --
> Ravi Mumulla (Microsoft)
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Phil Aldis" <PhilAldis@.discussions.microsoft.com> wrote in message
> news:5D4AF02E-618F-4FAD-9E52-473A5EAFBB70@.microsoft.com...
> > Hi,
> >
> > I'm just trying to get custom date formatting working. I have a datetime
> > variable plotted on an x axis of a scatter plot. The axis is marked as
> > continuous ('numeric of timescale values').
> >
> > I'd like the time to appear as eg 'Jan 04' and thought this would be
> > possible based on the posting by Robert Bruckner in response to 'Custom
> Date
> > Format' (09/Apr) in which he said that one could use these functions:
> >
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomdatetimeformatstrings.asp
> >
> > However I cannot get any of these codes to work. I have tried putting the
> > codes in or by putting the format code as this:
> >
> > =Format(Fields!calDay, "MMM")
> >
> > Woudl be very grateful if someone could tell me whether this is possible
> and
> > if so how I should go about it.
> >
> > Thanks,
> >
> > Phil
> >
> > PS I don't want to convert to a string as I have lots of values and quite
> > like keeping it as a continuous axis.
> >
> >
> >
> >
> >
>
>
Friday, February 24, 2012
Custom Code to Setup Parameter
I have a function that calcualte last_sunday date and return a datetime.
I have two Parameter in my report
start_date
end_date
and I put th following code in the report Parameer Properties
for Start date parameter
code.Last_Sunday
For End Date Parameter
code.Last_Sunday.adddays(6)
However when I ry to Preview I am getting this error
[rsReportParameterPropertyTypeMismatch] The property ‘DefaultValue’ of report parameter ‘Start_Date’ doesn't have the expected type.
[rsReportParameterPropertyTypeMismatch] The property ‘DefaultValue’ of report parameter ‘End_Date’ doesn't have the expected type.
Build complete -- 2 errors, 0 warnings
What I am doign Wrong both parameter are defined as datetime.
Thanks
Tanweer
Public Function Last_Sunday() As datetime
Dim Processed_date As DateTime
Dim start_date As DateTime
' Dim End_date As DateTime
Processed_date = DateTime.Today
'start_date = DateAdd(Processed_date - Weekday(Processed_date) + 1)
Select Case Processed_date.DayOfWeek.ToString
Case "Monday"
start_date = Processed_date.AddDays(-8)
Case "Tuesday"
start_date = Processed_date.AddDays(-9)
Case "Wednesday"
start_date = Processed_date.AddDays(-10)
Case "Thursday"
start_date = Processed_date.AddDays(-11)
Case "Friday"
start_date = Processed_date.AddDays(-12)
Case "Saturday"
start_date = Processed_date.AddDays(-13)
Case "Sunday"
start_date = Processed_date.AddDays(-14)
End Select
' End_date = format(start_date.AddDays(6),"mm/dd/yyyy")
console.writeline (start_date)
Return format(start_date,"MM/dd/yyyy")
End Function
You may want to try changing this line:
Return format(start_date,"MM/dd/yyyy")
to
CDate(Return format(start_date,"MM/dd/yyyy"))
The format function returns a string - not a DateTime...
Why are you formatting it here?
You mention a report...would it not be better to just pass the unformatted datetime to your report and handle the formatting in the report?
If you want create a re-usable function like this, it is better to return the raw data and handle formatting etc from where it is called. It is more generic and re-useable that way.
Steve