Friday, March 9, 2012

Pass where clause to Report dataset

Hi there,
Does anyone know how to or if it is possible to pass a where clause as a parameter to a dataset for a Reporting Services report? I have a case where depending on what is selected the where clause needs to be based on a different fields. Or otherwise if an if statement can be used in the dataset to overcome this problem.
ThanksI used to do this at design time using conditional expression like this:
="SELECT * FROM myTable" & IIF(Parameters!myValue.value="All", ""," where myColumn =" & Parameters!Linea.value)
or using stored procedures. Not sure you can set dataset definition at run time.
Antonio
"PLSH" wrote:
> Hi there,
> Does anyone know how to or if it is possible to pass a where clause as a parameter to a dataset for a Reporting Services report? I have a case where depending on what is selected the where clause needs to be based on a different fields. Or otherwise if an if statement can be used in the dataset to overcome this problem.
> Thanks|||In the data pane in report designer.
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Mike Jolliffe" <MikeJolliffe@.discussions.microsoft.com> wrote in message
news:34FC573B-36E7-44CC-BEEE-A725AD30BBDE@.microsoft.com...
> Antonio
> hi - i'm interested where you put this conditional statement to make it
work
> - in the source of a control or in the data area somewhere? I'd tried
> something similar and could not make it work.
> thanks
> Mike
>
> "Antonio Rome" wrote:
> > I used to do this at design time using conditional expression like this:
> >
> > ="SELECT * FROM myTable" & IIF(Parameters!myValue.value="All", "","
where myColumn =" & Parameters!Linea.value)
> >
> > or using stored procedures. Not sure you can set dataset definition at
run time.
> >
> > Antonio
> >
> > "PLSH" wrote:
> >
> > > Hi there,
> > >
> > > Does anyone know how to or if it is possible to pass a where clause as
a parameter to a dataset for a Reporting Services report? I have a case
where depending on what is selected the where clause needs to be based on a
different fields. Or otherwise if an if statement can be used in the dataset
to overcome this problem.
> > >
> > > Thanks
>|||Do you mean the SQL Pane? Tried this and received syntax errors.
"Ravi Mumulla (Microsoft)" wrote:
> In the data pane in report designer.
> --
> Ravi Mumulla (Microsoft)
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
> "Mike Jolliffe" <MikeJolliffe@.discussions.microsoft.com> wrote in message
> news:34FC573B-36E7-44CC-BEEE-A725AD30BBDE@.microsoft.com...
> > Antonio
> > hi - i'm interested where you put this conditional statement to make it
> work
> > - in the source of a control or in the data area somewhere? I'd tried
> > something similar and could not make it work.
> >
> > thanks
> > Mike
> >
> >
> > "Antonio Rome" wrote:
> >
> > > I used to do this at design time using conditional expression like this:
> > >
> > > ="SELECT * FROM myTable" & IIF(Parameters!myValue.value="All", "","
> where myColumn =" & Parameters!Linea.value)
> > >
> > > or using stored procedures. Not sure you can set dataset definition at
> run time.
> > >
> > > Antonio
> > >
> > > "PLSH" wrote:
> > >
> > > > Hi there,
> > > >
> > > > Does anyone know how to or if it is possible to pass a where clause as
> a parameter to a dataset for a Reporting Services report? I have a case
> where depending on what is selected the where clause needs to be based on a
> different fields. Or otherwise if an if statement can be used in the dataset
> to overcome this problem.
> > > >
> > > > Thanks
> >
>
>

No comments:

Post a Comment