Reporting Services IF statement

I have  the following If statement in Visual Studio reporting services:

=IIf(Fields!Company.Value = "company1", "Technical Hours", "Technical Sub Hours")

The issue I am having is that there are several values equal to "company1" in the database table, and several not equal to "company1" in the database, yet the Report is always outputting the title "Technical Sub Hours".  The "Company" field is String data type.  I have tried using Fields!Company.Value.toString().Equals("company1") but this does not work either.
zintechAsked:
Who is Participating?
 
mr_nadgerCommented:
also check your cases, "Company1" will give a false in the comparison
0
 
Alfred A.Commented:
Try this:

=IIf(Trim(Fields!Company.Value) = "company1", "Technical Hours", "Technical Sub Hours")
0
 
Jesus RodriguezIT ManagerCommented:
What I suggest also is check for the existance of the Company number an not for the string for example
=iif(INSTR(Fields!Company.Value,"1",CompareMethod.Text)>0,"Technical Hours", "Technical Sub Hours")
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.