Showing posts with label feature. Show all posts
Showing posts with label feature. Show all posts

Monday, March 19, 2012

DateTime Parameter

Reporting Services 2005 seems to have a problem with DateTime parameters.
One report has default datetime parameters. It uses the navigation feature
to call a second report, with the same parameters passed to the second
report. In the designer this works fine but when deployed the second report
crashes with an rsReportParameterTypeMismatch error.
This only happens when the dates being passed are non/ambiguous US/English.
In other words 6/1/06 will be passed OK 16/1/06 will not. Similarly 6-Jan-06
works, 16-Jan-06 doesn't.
So it's not really a type mismatch error but a dataconversion issue.
Both reports are set to language en-GB
Any help welcome!
Bob
--
--
BobBut if the parms are being passed as DateTimes instances, then there should
be no string format issues. Am I missing something?
--
William Stacey [MVP]
"Bob" <bmorris@.swiftkenya.com(nospamm)> wrote in message
news:9A881BF6-AFD2-4213-889A-F26EC8209F74@.microsoft.com...
| Reporting Services 2005 seems to have a problem with DateTime parameters.
|
| One report has default datetime parameters. It uses the navigation feature
| to call a second report, with the same parameters passed to the second
| report. In the designer this works fine but when deployed the second
report
| crashes with an rsReportParameterTypeMismatch error.
|
| This only happens when the dates being passed are non/ambiguous
US/English.
| In other words 6/1/06 will be passed OK 16/1/06 will not. Similarly
6-Jan-06
| works, 16-Jan-06 doesn't.
|
| So it's not really a type mismatch error but a dataconversion issue.
|
| Both reports are set to language en-GB
|
| Any help welcome!
|
| Bob
| --
| --
| Bob

Tuesday, February 14, 2012

DateAdd

Trying to use the DateAdd feature so I can do some MTD/YTD
comparisons. When I use the Expression builder, I am getting errors.
Using =DateAdd(yy, -1, 'parameter'), the yy is underlined in red.
I've tried year and Year. I've even seen it put into quotes ("yy").
I'm basically just trying to take the current date and subtract 1 year
from it. My ultimate goal is to create a report where I get LYTD/YTD
and MTD compared to the same month a year ago. This would key of a
report parameter since the user may want to look at particular month,
not just current. The report works fine as long as you manually put
in every date. I just need the DateAdd to make some automatic
calculations for me. Thanks in advance.On Dec 5, 3:51 pm, Barry <ba...@.tecelectric.com> wrote:
> Trying to use the DateAdd feature so I can do some MTD/YTD
> comparisons. When I use the Expression builder, I am getting errors.
> Using =DateAdd(yy, -1, 'parameter'), the yy is underlined in red.
> I've tried year and Year. I've even seen it put into quotes ("yy").
> I'm basically just trying to take the current date and subtract 1 year
> from it. My ultimate goal is to create a report where I get LYTD/YTD
> and MTD compared to the same month a year ago. This would key of a
> report parameter since the user may want to look at particular month,
> not just current. The report works fine as long as you manually put
> in every date. I just need the DateAdd to make some automatic
> calculations for me. Thanks in advance.
DateAdd is very finicky, and the documentation is really poor. It's
case sensitive, and only certain combinations seem to work. You will
want to use yyyy for Year, M or m for Month, d for Day, H for hour, n
for Minute, s for Second.
You want to not use the double quotes when you are using the function
in SQL, but do use the quotes when it is in a .Net expression.
1 Year Ago from Date
= DateAdd( "yyyy", -1, Parameters!CurrentYearsDate.Value )
-- Scott|||On Dec 5, 3:30 pm, Orne <polysilly...@.yahoo.com> wrote:
> On Dec 5, 3:51 pm, Barry <ba...@.tecelectric.com> wrote:
> > Trying to use theDateAddfeature so I can do some MTD/YTD
> > comparisons. When I use the Expression builder, I am getting errors.
> > Using =DateAdd(yy, -1, 'parameter'), the yy is underlined in red.
> > I've tried year and Year. I've even seen it put into quotes ("yy").
> > I'm basically just trying to take the current date and subtract 1 year
> > from it. My ultimate goal is to create a report where I get LYTD/YTD
> > and MTD compared to the same month a year ago. This would key of a
> > report parameter since the user may want to look at particular month,
> > not just current. The report works fine as long as you manually put
> > in every date. I just need theDateAddto make some automatic
> > calculations for me. Thanks in advance.
> DateAddis very finicky, and the documentation is really poor. It's
> case sensitive, and only certain combinations seem to work. You will
> want to use yyyy for Year, M or m for Month, d for Day, H for hour, n
> for Minute, s for Second.
> You want to not use the double quotes when you are using the function
> in SQL, but do use the quotes when it is in a .Net expression.
> 1 Year Ago from Date
> =DateAdd( "yyyy", -1, Parameters!CurrentYearsDate.Value )
> -- Scott
PERFECT!!! I have spent many numerous hours searching for the correct
syntax. Worked great! Thanks so much.