Solved

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

Posted on 2011-03-02
4
498 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Time Corrections for Reports Working with a report, we made some interesting discoveries about the time corrections/updates We are using the following Parameters: Starting Entered Date (Date) formatted as Data type: "Date/Time" Ending Entered …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

728 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

8 Experts available now in Live!

Get 1:1 Help Now