Date picker parameter
I have a SSRS report in Visual Studio 2008 with one dataset. This dataset has a SalesDate field. I need to add 2 date picker parmaters based on this field a From Date and a To Date. I need the report data to be filtered in between these 2 dates.
May 11th, 2011 9:42am
Hi,
To do this, you can
1) Create two parameters which has datatype date and name them from and to date
2) Then in dataset add parameter information to dataset and if your source is sql then add a where condition for SalesDate beween @fromDate and @toDate.- Chintak (My Blog)
Free Windows Admin Tool Kit Click here and download it now
May 11th, 2011 9:49am
The source is SQL for the dataset. On (1) I have created 2 parameters with a data type of System.Date. On (2) when you say add parameter information to dataset does that mean add a filter and if so do I need to add 2 filters one for each parameter? Then
on the filters under the expression it should have something like = Where Fields!.SalesDate.Value between Paramters!FromDate.Value and Paramters!ToDate.Value
Is that correct because I'm receiving an error FilterDateRange has invalid expression for property 'expression' . where is invalid.invalidIdentifier. I;m not sure what the correct SQL syntax should be for the filter expression.
May 11th, 2011 10:20am
Hi Ok,
You should have dataset query as something like below:-
DECLARE @FROM DATETIME
DECLARE @TO DATETIME
SET @FROM = '2011-05-01 10:25:18.280'
SET @TO = '2011-05-11 10:25:18.280'
CREATE TABLE #TEMP
(
DT DATETIME
)
INSERT INTO #TEMP VALUES ( '2011-05-11 10:25:18.280' )
INSERT INTO #TEMP VALUES ( '2011-04-19 10:25:18.280' )
INSERT INTO #TEMP VALUES ( '2011-05-09 10:25:18.280' )
INSERT INTO #TEMP VALUES ( '2011-05-21 10:25:18.280' )
SELECT DT
FROM
#TEMP
WHERE
DT BETWEEN @FROM AND @TO
DROP TABLE #TEMP
Assuming, @FROM & @TO as your report level parameter.
Please let us know your feedback.
Thanks
KumarKG, MCTS
Free Windows Admin Tool Kit Click here and download it now
May 11th, 2011 10:33am
Edit your main dataset query. In where condition give SalesDate Between @StardDate and @Enddate.
After that, you are able to see to Parameters in your parameter list as @StardDate and @EndDate. Select each parameter and go to parameter properties and change the parameter data type to Date/Time. Available values should be None.
I hope this helps
Tarak
May 11th, 2011 10:38am
Hi,
Plz try this
- Create two parameters with datatype date
- and then configure the to date on from date selection so that todate must be greater than from date
- add condition for from date and to date for dates in report datasource.Thanks, Pranil Yambal | MCTS | Pranil.Yambal@hotmail.com
Free Windows Admin Tool Kit Click here and download it now
May 11th, 2011 10:39am