Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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 …
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

722 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