Solved

Reporting Services IF statement

Posted on 2010-11-23
3
742 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now