Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-03-02
4
Medium Priority
?
513 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 29

Accepted Solution

by:
sammySeltzer earned 500 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 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

877 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