Solved

Reporting Services IF statement

Posted on 2010-11-23
3
746 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Amazon S3 .Net error 5 38
PowerShell:  Where-Object not working as a filter 2 71
How to force output to ascii 2 34
"The resource cannot be found" 1 22
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

761 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