ssrs expression help

I'm wanting to set a background color in my report to turn red if one condition is like "DOM" and a second condition is either "USA" or "SEECERT".  I have tried to get the syntax correct and haven't figured it out.

=iif(Fields!item_id.Value) Like "%DOM%" AND (Fields!coo.Value <> "USA" OR Fields!coo.Value <> "SEECERT"), 'Red', 'No Color'

Using Visual Studio 2012
LVL 4
Sue TaylorProject ManagerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vaibhav GoelMSBI , SQL ConsultantCommented:
Hello ITworks

Please make an attempt to use changed code ->

=iif(Fields!item_id.Value Like "*DOM*" AND (Fields!coo.Value <> "USA" OR Fields!coo.Value <> "SEECERT"), 'Red', 'No Color')


Or Make an attempt for below


=iif(Fields!item_id.Value Like "%DOM%" AND (Fields!coo.Value <> "USA" OR Fields!coo.Value <> "SEECERT"), 'Red', 'No Color')

Vaibhav
0
ValentinoVBI ConsultantCommented:
SSRS expressions and SQL are two different languages. Both the Q and the first A contain a mix of both. SSRS expressions are actually based on VB.NET.  Try using InStr instead of LIKE.

Also, that OR condition in combination with <> doesn't make sense. Depending on what you want it should either be AND or <> should be =.

=iif(InStr(Fields!item_id.Value, "DOM") AND (Fields!coo.Value <> "USA" AND Fields!coo.Value <> "SEECERT"), 'Red', 'No Color')

Open in new window


or

=iif(InStr(Fields!item_id.Value, "DOM") AND (Fields!coo.Value = "USA" OR Fields!coo.Value = "SEECERT"), 'Red', 'No Color')

Open in new window

0
Sue TaylorProject ManagerAuthor Commented:
None of the solutions provided worked.  I would always get an error BC30201.

The ItemID field is a varchar40
The coo field is a varchar255

I'm using Visual Studio 2012

I am entering this expression in the FILL section of Text Box Properties

I want to be able to change the color if the ITEMID contains the characters "DOM" in it and the coo is NOT either "USA" or "SEECERT"

"DOM" is an abbreviation for domestic.  "DOM" can be anywhere within the field.  Examples are:
     62C225BA2G/DOM/LW
     62C225BLIM/DOM
     50F300HCS8/DOM-NP

The coo field stands for country of origin.  Examples of this field are:
CHINA
TAIWAN
USA
SEECERT
JAPAN
INDIA

My goal is to be able to quickly show the report reader an Item ID that is supposed to be domestic having a coo something other than USA or SEECERT.
0
Sue TaylorProject ManagerAuthor Commented:
I'm closer.  I don't have errors but I'm not getting the results how I expected them to be.   I have the following expression in my FILL

=iif(Fields!item_id.Value Like ("*DOM*")  AND
(Fields!coo.Value <> "USA" or Fields!coo.Value <> "SEECERT"), "Red", "No Color")

My results show RED Fill on these two items:

150C450B3N/DOM  COO = CHINA so I expect that to be Red
but
150C475B3N/DOM COO-USA is also Red but this shouldn't be Red because it lists USA as the COO
0
ValentinoVBI ConsultantCommented:
Try replacing or with and
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.