malraff
asked on
ssrs 2005: sub report date issue
hi all
i have an ssrs report where i pass two date variables 1) date_from 2)date_to
the parameters work fine on the dashboard home page, but when i access a sub report from a graph etc they return no data..
if i take one of the dates out it returns as expected..
eg a basic example of one of the subreport data is
i have linked both the date parameters to the same date field action part of the graph
and if i run the query simply from data section it also returns the correct information!
am i doing something silly? its been a long week!! :)
i have an ssrs report where i pass two date variables 1) date_from 2)date_to
the parameters work fine on the dashboard home page, but when i access a sub report from a graph etc they return no data..
if i take one of the dates out it returns as expected..
eg a basic example of one of the subreport data is
select (case when owneraccount is null then updatedby else owneraccount end)as owneraccount ,cast(convert(char(11), addeddate, 111) as datetime)as addeddate,
Departmentname ,servicereqno,SubCategory,state
from dbo.q_incidents
where owneraccount = @owner
and addeddate >= @date_from
and addeddate <= @Date_To
i have linked both the date parameters to the same date field action part of the graph
and if i run the query simply from data section it also returns the correct information!
am i doing something silly? its been a long week!! :)
ASKER
yea i have both added as datetimes, and they both exist on the subreport as well
it really should just work as far as i see
it really should just work as far as i see
just for kicks, can you try:
and addeddate between @date_from and @Date_To
ASKER
tried that also sammy! same issue
Only other thing I can think of is to cast all the date params:
and cast(convert(char(11), addeddate, 111) >= cast(convert(char(11), @date_from, 111)
and cast(convert(char(11), addeddate, 111) <= cast(convert(char(11), @Date_To, 111)
ASKER
i see the issue!
i set the parameters to viewable on the subreport
and for some reason it is showing the "date_to" value to be the same as the "Date_from"
-- strange, i dont see how they are getting mixed up!
i set the parameters to viewable on the subreport
and for some reason it is showing the "date_to" value to be the same as the "Date_from"
-- strange, i dont see how they are getting mixed up!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
solved it myself
For instance, i am sure you built the report first before adding it to your main report.
So, on the sub report, you click on Reports (at top of page), click parameters.
On the parameters screen, check to see that your date params are there.
If they are, make sure their data types are datetime, not String.
If they are not, to the left of the screen, Click the Add button to add your date parameters.
Lot of times, they are not added automatically.