Thursday, March 29, 2012

filter expressions combined with OR instead of AND

I need to combine filter expressions for my report item with the OR-logic -
but the Reporting Services dialog window is set on the AND-logic. How can I
get past this?
Example
======
What I need is the following:
Fields!Name1 = Parameters!Name
OR
Fields!Name2 = Parameters!Name
What I get from Reporting Services is the following:
Fields!Name1 = Parameters!Name
AND
Fields!Name2 = Parameters!Name
Thank you for your help.I think you can set that in the Expression builder, there is a column called
condition... But if for some reason it doesn't work properly go to the
generic query builder and simply type your expression
Sorry - you are talking about the filter... You could make a function in
the code section, pass both of the field values and parameter values into
the function and return 1 to include the row and 0 to exclude it...Then your
filter expression would be
GetFilter(Fields!Name1.Value,Fields!Name2.Value, Parameters!Name) = 1
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"j schuetz" <j schuetz@.discussions.microsoft.com> wrote in message
news:E5CA33E2-B55D-496D-A48D-C94892135151@.microsoft.com...
> I need to combine filter expressions for my report item with the
OR-logic -
> but the Reporting Services dialog window is set on the AND-logic. How can
I
> get past this?
> Example
> ======> What I need is the following:
> Fields!Name1 = Parameters!Name
> OR
> Fields!Name2 = Parameters!Name
> What I get from Reporting Services is the following:
> Fields!Name1 = Parameters!Name
> AND
> Fields!Name2 = Parameters!Name
> Thank you for your help.
>
>|||Dear Wayne
Thank you for your advice. However, I am a controller, not a programmer.
When I am working with RS, I only use the graphic interface - never the code
section... (-;
Is there not a more user-friendly (controller-friendly...) way around this
problem?
Thanks again.
"Wayne Snyder" wrote:
> I think you can set that in the Expression builder, there is a column called
> condition... But if for some reason it doesn't work properly go to the
> generic query builder and simply type your expression
> Sorry - you are talking about the filter... You could make a function in
> the code section, pass both of the field values and parameter values into
> the function and return 1 to include the row and 0 to exclude it...Then your
> filter expression would be
> GetFilter(Fields!Name1.Value,Fields!Name2.Value, Parameters!Name) = 1
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> www.mariner-usa.com
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> www.sqlpass.org
> "j schuetz" <j schuetz@.discussions.microsoft.com> wrote in message
> news:E5CA33E2-B55D-496D-A48D-C94892135151@.microsoft.com...
> > I need to combine filter expressions for my report item with the
> OR-logic -
> > but the Reporting Services dialog window is set on the AND-logic. How can
> I
> > get past this?
> >
> > Example
> > ======> >
> > What I need is the following:
> >
> > Fields!Name1 = Parameters!Name
> > OR
> > Fields!Name2 = Parameters!Name
> >
> > What I get from Reporting Services is the following:
> >
> > Fields!Name1 = Parameters!Name
> > AND
> > Fields!Name2 = Parameters!Name
> >
> > Thank you for your help.
> >
> >
> >
>
>|||Hi,
I also had this problem and discovered that if you put the common filed
first Reporting Services will give you an OR.
So if youy enter your parameters as follows:
Parameters!Name = Fields!Name1
then
Parameters!Name = Fields!Name2
Reporting Services will generate:
Parameters!Name = Fields!Name1
OR
Parameters!Name = Fields!Name2
Steve
"j schuetz" wrote:
> I need to combine filter expressions for my report item with the OR-logic -
> but the Reporting Services dialog window is set on the AND-logic. How can I
> get past this?
> Example
> ======> What I need is the following:
> Fields!Name1 = Parameters!Name
> OR
> Fields!Name2 = Parameters!Name
> What I get from Reporting Services is the following:
> Fields!Name1 = Parameters!Name
> AND
> Fields!Name2 = Parameters!Name
> Thank you for your help.
>
>|||Too bad, but at least you know the differences between AND and OR :))
In any case, you'd be in a much better shape if you do filtering in
your SQL query, not in the report itself. RS filtering is evil,
because it makes SQL server pull ALL the data from the query, just to
throw away some of it later. It would be much more efficient (and
easier) to apply your filtering in your query (dataset):
SELECT ...
FROM ...
WHERE Name1 = @.paramName OR Name2 = @.paramName
On Mon, 24 Jan 2005 07:13:06 -0800, j schuetz
<jschuetz@.discussions.microsoft.com> wrote:
>Dear Wayne
>Thank you for your advice. However, I am a controller, not a programmer.
>When I am working with RS, I only use the graphic interface - never the code
>section... (-;
>Is there not a more user-friendly (controller-friendly...) way around this
>problem?
>Thanks again.
>
>"Wayne Snyder" wrote:
>> I think you can set that in the Expression builder, there is a column called
>> condition... But if for some reason it doesn't work properly go to the
>> generic query builder and simply type your expression
>> Sorry - you are talking about the filter... You could make a function in
>> the code section, pass both of the field values and parameter values into
>> the function and return 1 to include the row and 0 to exclude it...Then your
>> filter expression would be
>> GetFilter(Fields!Name1.Value,Fields!Name2.Value, Parameters!Name) = 1
>> --
>> Wayne Snyder, MCDBA, SQL Server MVP
>> Mariner, Charlotte, NC
>> www.mariner-usa.com
>> (Please respond only to the newsgroups.)
>> I support the Professional Association of SQL Server (PASS) and it's
>> community of SQL Server professionals.
>> www.sqlpass.org
>> "j schuetz" <j schuetz@.discussions.microsoft.com> wrote in message
>> news:E5CA33E2-B55D-496D-A48D-C94892135151@.microsoft.com...
>> > I need to combine filter expressions for my report item with the
>> OR-logic -
>> > but the Reporting Services dialog window is set on the AND-logic. How can
>> I
>> > get past this?
>> >
>> > Example
>> > ======>> >
>> > What I need is the following:
>> >
>> > Fields!Name1 = Parameters!Name
>> > OR
>> > Fields!Name2 = Parameters!Name
>> >
>> > What I get from Reporting Services is the following:
>> >
>> > Fields!Name1 = Parameters!Name
>> > AND
>> > Fields!Name2 = Parameters!Name
>> >
>> > Thank you for your help.
>> >
>> >
>> >
>>|||Thanks to Steve and Usenet User for their helpful piece of advice. Now I am
getting along!

No comments:

Post a Comment