I'm trying to create a Report in SQL Report Builder 3.0 and I need your help to add a "Parameter" filter for the Report which will run the report and display rows with this parameter filter values. The parameters I want are Day
and Week
.
Now the first, Day
would display rows using TestingTime
(a column from the database table, its a datetime column) as the date column from getdate()
minus 24 hours.
The second, Week
would display rows with getdate() minus 7 days.
I have one DataSet query that runs the report right now that looks like this:
select ElementTesterMeasData.RecID, WindingProdData.Machine,
ElementTesterMeasData.Felkod, ElementTesterMeasData.MeasP2AntalClear,
ElementTesterMeasData.TestingTime
from DRYDCAP.dbo.WindingProdData
full outer JOIN ElementTesterMeasData
on ElementTesterMeasData.RecID=WindingProdData.SerialNumber
where Machine in (@Maskin)
and Felkod in (@Felkoder)
order by Testingtime desc
The part where Machine in (@Maskin) and Felkod in (@Felkoder)
points to 2 other parameters that i use in the report to filter what rows to display.
What would I have to add to this Query (or new dataset query) to make this work? And what would I have to add to Parameters that filters the returning rows with data from NOW -1 day back, or NOW -1 week back? If something is unclear I will try to explain the best I can.
BR,
Mikael