Solved

Reporting Services IF statement

Posted on 2010-11-23
3
744 Views
Last Modified: 2012-05-10
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.
0
Comment
Question by:zintech
3 Comments
 
LVL 21

Assisted Solution

by:Alfred1
Alfred1 earned 166 total points
ID: 34202803
Try this:

=IIf(Trim(Fields!Company.Value) = "company1", "Technical Hours", "Technical Sub Hours")
0
 
LVL 7

Accepted Solution

by:
mr_nadger earned 167 total points
ID: 34204357
also check your cases, "Company1" will give a false in the comparison
0
 
LVL 13

Assisted Solution

by:Jesus Rodriguez
Jesus Rodriguez earned 167 total points
ID: 34206983
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

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question