Solved

How to insert a boolean function in to the coding of an ssrs report

Posted on 2011-03-02
4
501 Views
Last Modified: 2012-06-27
I'm trying to change the background colour of a cell in a table of a 3-table report dependent on it's content. Basically if it contains "fail", "failure", "failed"  or "not sent" I want the background to be red.

If I did a nested IIF statement to cover each of these it would become unwieldy and unmanageable. Found some suggestions to do a function in custom code in the report properties, but I'm not that good on vb.net code and there's no intuitivism in the code box to be able to build it easily. Is anyone able to help please?
0
Comment
Question by:Grffster
[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
4 Comments
 
LVL 29

Accepted Solution

by:
sammySeltzer earned 125 total points
ID: 35017649
I am assuming that you are trying to give a different background based on the value.

For instance, if value is "fail", give some background.

If value is "failure" give some background.

If value is value is "failed", give some other background.

if this is what you are trying to accomplish, can you tr this:

Highlight the fieldname, go to properties, click on background, select expression and try this:


=Switch(Fields!field.Value ="fail", "blue", Fields!field.Value ="failure", "red", Fields!field.Value = "failed", "green")

See if this works
0
 
LVL 10

Expert Comment

by:itcouple
ID: 35018045
Personally I would do that in SQL (UDF or SP) to return extra colum "color" then just use expression =Fields!Color.Value in the background property. It will be more reusable, maintanable + better performance.

Regards
Emil
0
 
LVL 27

Assisted Solution

by:planocz
planocz earned 125 total points
ID: 35018260
Here is a sample of what you could do in the Code Tab of your report.

http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Q_26771904.html

If you need more I can build a new function.
0
 

Author Closing Comment

by:Grffster
ID: 35018558
Thanks both. Wasn't aware of switch which I will use from now on, although, understanding the custom code functionality too was a side-purpose of this question so have shared the points between you.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
XML error not understood 5 33
ASP.NET Calendar Control 5 54
parameters reportbuilder 1 32
vb.net application has warrnings about VB6 calls. 2 48
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It is helpful to note: This is a cosmetic update and is not required, but should help your reports look better for your boss.  This issue has manifested itself in SSRS version 3.0 is where I have seen this behavior in.  And this behavior is only see…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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