• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1131
  • Last Modified:

Question related to conditional formatting inside of a Matrix report(SSRS)

One of the columns in my matrix is TaskCode. I want to change the way a specific column appears if it's the taskcode Trusses. So if the TaskCode.Value = 'Trusses' change the color. I am new to SSRS and am wondering if this is possible and if so, where and how the expression should be constructed.

Thanks for any help you can provide!
0
J C
Asked:
J C
  • 7
  • 4
2 Solutions
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>So if the TaskCode.Value = 'Trusses' change the color.

(1)  Go to the textbox and do a right-click:Text box Properties ....  This will display the Text Box Properties dialog.
(2)  On the left side click on Font.
(3)  When you see the Color combo box, click on the expression ( fx ) button to the right of it.  This will display the Expression editor.
(4)  Add this (change the colors to suit your needs:

=IIF(Fields!TaskCode.Value = "Trusses", "Red", "Black")

You can also use the Category treeview, Fields section to display different fields.

(5)  Hit the Ok button twice to save, then display in Preview mode.
0
 
J CAuthor Commented:
Thanks a lot! If I want to apply conditional formatting to other taskcodes, would I just add another IIF on the line below? Do they have to be separated with a comma?
0
 
J CAuthor Commented:
I am receiving this warning as well. My formula's are working as expected. I am not sure where this warning is being generated from.

Warning      1      [rsInvalidColor] The value of the Color property for the textrun ‘description.Paragraphs[0].TextRuns[0]’ is “Rim”, which is not a valid Color.      C:\Users\administrator.mydomain\Documents\Visual Studio 2008\Projects\ScheduleTrackingMatrix\ScheduleTrackingMatrix\Schedule Tracking Matrix.rdl      0      0
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
J CAuthor Commented:
Can you apply multiple conditions for formatting to a single textbox?

For example. I currently have an expression for my actualenddate row where if taskcode.value = "trusses", "white". "black". This works great. What if I want to make the font color green if the actualenddate.value <= plannedenddate.value for all taskcode's other than trusses is that possible? I want to leave trusses alone and leave the formatting as white but for all other's I want to be able to base the font color on other conditions. Let me know!

Thanks!
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>Can you apply multiple conditions for formatting to a single textbox?
Yes, you'll have to daisy-chain/nest the IF statemnts, like this...

=IIF(Fields!TaskCode.Value = "Trusses", "Red", IIF(Fields!TaskCode.Value = "Bananas", "Yellow"), "Black")

Not sure if there is a SELECT CASE / IF .. ELSE way to handle multiple values more gracefully.
0
 
J CAuthor Commented:
=IIF(Fields!taskcode.Value = "Trusses", "White", IIF(Fields!actualenddate.Value <= Fields!actualenddate.Value, "Green"), "Red")

So in theory the above should work? Both dates exist inside of my dataset but it throws me an error when I try to use the above statement.

I attached the SS with the error.
error.png
0
 
J CAuthor Commented:
I changed it so that the second actuanenddate is actually planstardate
0
 
J CAuthor Commented:
Let me know if you can see what I am doing wrong.

Thanks for all your help!
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Give this a whirl..

=IIF(Fields!taskcode.Value = "Trusses", "White", IIF(Fields!actualenddate.Value <= Fields!actualenddate.Value, "Green", "Red"))
0
 
J CAuthor Commented:
Thanks a lot!
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Thanks for the grade.  Good luck with your project.  -Jim
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now