Wilest
Wilest

Reputation: 1870

Filter tablix with two "Like" operations combined by an "Or"

I need to filter on a tablix to return where values in the string contains "BLACK" OR "RED":

Expression:  =Fields!DrawOfficeNum.Value Like "*BLACK*" AND Fields!DrawOfficeNum.Value Like "*RED*"
Operator:    Like
Value:       True

I'm getting no results back and I know there is results. Help will be greatly apreciated!

Upvotes: 1

Views: 5622

Answers (3)

NoNo
NoNo

Reputation: 1

It seems to work more easily in this way :

  • In the "Expression" box, put [DrawOfficeNum]
  • In the Operator box, choose In
  • In the Value box, put BLACK; RED

It will know that you works on a string type (depends on your field type), and generate a list separated with ;

If i am wrong, can anyone tell me?

Upvotes: 0

Jeroen
Jeroen

Reputation: 63830

Quote, emphasis mine:

I need to filter...where values in the string contains "BLACK" OR "RED":

Quote, emphasis mine:

=Fields!DrawOfficeNum.Value Like "*BLACK*" AND Fields!DrawOfficeNum.Value Like "*RED*"

Change the AND into OR in your expression, then you're good to go.

Upvotes: 3

Ian Preston
Ian Preston

Reputation: 39586

I would do it like this:

Expression (Text type):

=IIf(InStr(Fields!DrawOfficeNum.Value, "BLACK") > 0 or InStr(Fields!DrawOfficeNum.Value, "RED") > 0
    , "Include"
    , "Exclude")

Operator: =

Value: Exclude

enter image description here

This gives results:

enter image description here

Only thing to not is that I turned the filter from a Boolean to a Text type - in the past I've always had problems with Boolean filters and the option above works well, as per the screenshot.

Upvotes: 8

Related Questions