Solved

Conditional cell color formatting in SQL Report Table

Posted on 2007-11-26
9
1,022 Views
Last Modified: 2010-05-18
Hello -
I've got a bit of a complicated formatting problem I can't figure out how to implement.  Basically I have a table with a datasource set to a stored procedure that computes a correlation matrix.  I would like to format four different settings.

1) All items in the last row are a shade of light blue
2) All itmes in the second to last row are a shade of light yellow (except the last cell)
3)All items in the last column are the same shade of light blue (easy - just set the bgcolor to the color)
4) All itmes along the horizontal line of the matrix are grey except the last item in the last column which should  remain light blue.

I've worked with much more basic formatting and using some simple embedded code but if anyone has a good example of how to best implement this I would SOOOOO appreciate it.

Thanks so much!
~E

0
Comment
Question by:gigglick
9 Comments
 
LVL 16

Expert Comment

by:SQL_SERVER_DBA
Comment Utility
use reporting services
0
 
LVL 12

Expert Comment

by:kselvia
Comment Utility
Not sure if this is of any use but I gave up on making SRS color cells based on various report values.  I just returned a column called color from the stored procedure and set the bgcolor to color.value from the dataset.

You can get as complicated as you want in the stored procedure.

Made it easy to change colors too since I could just change the stored procedure.
0
 
LVL 5

Author Comment

by:gigglick
Comment Utility
Hi kselvia:

Unfortunately, I don't think that will work for this particular problem as it's more of a row/cell issue I am having but it's it a GREAT (and very creative) idea I'll definitely try in the future!

~E
0
 
LVL 5

Author Comment

by:gigglick
Comment Utility
I've got part 1-3 but I can't figure out the horizontal line:

=iif(RowNumber("HTrading_Impact")=14, "LemonChiffon",iif(RowNumber("HTrading_Impact")=15, "LightSteelBlue","Nothing"))

I am pretty sure I just need to change the last "Nothing" to another if where basically I do

if the (RowNumber-1/Columnumber) = 1 make it gray.  

Does anyone know how to deal with column numbers.  Everything I try is throwing errors.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 5

Author Comment

by:gigglick
Comment Utility
I've got part 1-3 but I can't figure out the horizontal line:

=iif(RowNumber("HTrading_Impact")=14, "LemonChiffon",iif(RowNumber("HTrading_Impact")=15, "LightSteelBlue","Nothing"))

I am pretty sure I just need to change the last "Nothing" to another if where basically I do

if the (RowNumber-1/Columnumber) = 1 make it gray.  

Does anyone know how to deal with column numbers.  Everything I try is throwing errors.
0
 
LVL 5

Author Comment

by:gigglick
Comment Utility
Final Solution:

=iif((RowNumber("HTrading_Impact"))/2=1, "Gainsboro",iif(RowNumber("HTrading_Impact")=14, "LemonChiffon",iif(RowNumber("HTrading_Impact")=15, "LightCyan",iif(RowNumber("HTrading_Impact")=1, "Gainsboro","Nothing"))))
0
 
LVL 1

Expert Comment

by:ltmnm
Comment Utility
Hello I'm trying to do something very close to what you have.  I have a report with the last column being a calculated result.  Basically I have an iif statement that checks if the difference between two numbers are in a range.  If they are it makes that row equal to a text value.  I want to add into this iif statement font coloring depending on the text.  Here is what I have working:

=IIF(Sum(Fields!FEQuant.Value)>=Fields!ContractLimit.Value, "VIOLATION", IIF(((Fields!ContractLimit.Value)-(Sum(Fields!FEQuant.Value)))=25,"WARNING",""))

How do I add to this so that it checks if it is a "VIOLATION" then make the font Red and if it is "WARNING" it should be Yellow?  

Thank you for all your help.
0
 
LVL 1

Accepted Solution

by:
ltmnm earned 500 total points
Comment Utility
Never mind my question.  I located where to put the IIF expression.  For anybody who would like to know: just highlight the cell then go to the properties panel at the right of the screen and click on color.  the drop down menu opens and you select <expression>.  In there you can put the color changing IIF statement.
0
 
LVL 5

Author Comment

by:gigglick
Comment Utility
I answered my own ? and seems you did as well...so to close this ? I'm going to send the points your way.

Gig
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

744 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