Solved

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

Posted on 2011-03-02
4
499 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
4 Comments
 
LVL 28

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

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

Suggested Solutions

This code started out as a fix for a customer that had incoming data that was hunderds of numbers and words long that was to fit in one column. The problem was that the customer did not want to split words or numbers when wrapping in the column. …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 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

16 Experts available now in Live!

Get 1:1 Help Now