0

enter image description here

I have built matrix report with 2 parameters one individual and other one is cascading parameter

when we have values than background color is working but, if no data background color is not working

Is there any solution to apply even though no data also in database

  • 1
    If there are no values, then there can't be a background colour in the matrix; there's no data. That's like saying you want the text to be blue, but when there is no text you still want the text to be visually blue. How can the text be blue, when there is no text? – Thom A Jan 07 '20 at 12:37
  • What is the alternate solution for this? – Kalleshi KS Jan 07 '20 at 12:42
  • Alternate what? You can't alternate colours when there are no rows either. Does this answer your question? [Add alternating row color to SQL Server Reporting services report](https://stackoverflow.com/q/44376/2029983) – Thom A Jan 07 '20 at 12:43
  • Yes, you are right if there is no row/values than can't do anything, thank you @Larnu – Kalleshi KS Jan 07 '20 at 12:45
  • Try `=iif(rownumber(nothing) mod 2 = 0, "color1","color2")` for the row background color. – Michael Vine Jan 07 '20 at 12:50
  • Hi Michael, They want background color for specific record not for all records that's why its bit difficult, I have written expression it works well if there is data but no records for particular value combination in that case background color is not working. I have hardcoded "NA" instead of showing blank – Kalleshi KS Jan 07 '20 at 13:14
  • So what you want is the 'NA' cell to also be the background color? I am a little confused as to what you are asking. – Diego Jan 08 '20 at 17:00
  • Hi Diego, Physically data is not available for particular columns values combination but, in report level i have hardcoded with "NA" wherever have no data so now is it possible to show background color in report level. – Kalleshi KS Jan 09 '20 at 06:30
  • @KalleshiKS Yes, you can set an expression to a color. In the textbox properties, go to background color and there is an expression option you can do something like this `=IIf(Fields!FieldYouAreUsing = "NA", "Gray", "Transparent")`. You can modify the if statement to fit your needs, I just gave a quick example. – Diego Jan 10 '20 at 16:48
  • Hi @Diego, it won't work because data NA or Null is not available physically in db that's why above expression won't work – Kalleshi KS Jan 11 '20 at 21:15

1 Answers1

0

We can apply background color in matrix report also, here is the link can refer

[Alternate Row Background Color in SQL Server Reporting Services Tablix and Matrix]

https://www.mssqltips.com/sqlservertip/3490/alternate-row-background-color-in-sql-server-reporting-services-tablix-and-matrix/

The above link is helpful to apply alternate background color to the records/fields

If we want to apply back ground color for specific records than specific records than 
have to modify the below expression like:

Here numbers like 964, 5003 etc., are serial/row number based on that can apply background color to specific records

  =Switch(VAL(ReportItems!ROWCOLOR.Value)=964, "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=5003,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=5337,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=6241,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=8561,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=8673,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=13282,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=13775,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=1211,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=7361,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=7746,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=8556,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=10846,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=10994,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=13290,  "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=2243,   "#D9D9D9",
    VAL(ReportItems!ROWCOLOR.Value)=2607,   "#D9D9D9"
    )

I have created one group "Group1" and right click on textbox and written expression : RowNumber(nothing) to generate serial number

I have written numeric number 1 in a group

In below image first field of the expression contains RowNumber(nothing)

https://i.stack.imgur.com/kGCue.png

https://i.stack.imgur.com/swlo4.png

https://i.stack.imgur.com/OpvAh.png

https://i.stack.imgur.com/stUn1.png

https://i.stack.imgur.com/8gaiG.png

https://i.stack.imgur.com/CJI9f.png

https://i.stack.imgur.com/d75Zd.png