Highlighting a row once a parameter has been selected in SSRS - reporting-services

I have a report that has 3 parameters: RaceDate, RaceCourse, SilksColours. The SilksColours parameter is optional.
If the SilksColours parameter is selected I want to highlight the row in my report with the colour yellow, while all the other rows stay white.
Is this possible?

For each TextBox in the row you want to highlight, you need need to set the Background Color property to be expression-based and compare the parameter value to value in the row, something like:
=IIf(Fields!Colour.Value = Parameters!SilksColours.Value, "Yellow", "White")
Edit after comments:
OK, as you've noted there are two questions here.
Parameter with default
You have a requirement to have a multi-value parameter with the ability to specify no value in particular. You can't set up a multi-value to accept NULL values, so you need to add a catch all value to the DataSet. So base the parameter on values similar to the following:
Set a parameter up to use this DataSet and set the Default Value to None:
Now we have a parameter with a default, which will not highlight any rows, so users can just ignore if they want or choose values as required.
There is one minor annoyance here - the user can select None and other values as well, they aren't mutually exclusive, but it should be good enough.
Highlighting rows
Next step is to set the Background Color values for all required TextBoxes. Since multiple colours can be selected, we need to treat multi-value parameters differently from single ones, something like:
=IIf(InStr(Join(Parameters!Colour.Value, ","), Fields!Colour.Value) > 0
, "Yellow"
, "White")
So what we need to do is use the JOIN function to create a string list of selected values, then check if the row value is anywhere in that list. Put it all together to get the following:
The report will load straight away as the parameter has a default value, with no rows highlighted:
Choose one colour and the row is highlighted:
Choose multiple colours to highlight multiple rows:
Hopefully all this is what you're after!

Related

SSRS parameter Default value not showing correctly on filter bar

When my month Parameter's Value and Label fields are not the same the default value assigned does not display correctly on the filter bar.
Available Values
When viewing the report the Month filter shows as in the image.
IncorrectFilterView
When I make both the Value and Label fields the same the Month filter shows as in this image.CorrectFilterView
The expression I use for the Default value is: =Format(DATEADD(DateInterval.Month,-1,Today),"MMM")
I have also tried: =DATEADD(DateInterval.Month,-1,Today)
I can continue bit both the Value and Label fields being set to MonthShort, but this makes getting the month number a mission in some of my calculations.
I'm also considering adding another hidden param just for the number.
Your default value should the the same type as the 'Value' field not the label field.
Just change the default expression to
=Format(DATEADD(DateInterval.Month,-1,Today),"MM")
this will give you 12 rather tyan 'Dec'. The parameter will show as 'Dec' in the dropdown list though as 'Dec' is the label for 12.
Remember, the parameters label property is primarily there for the user, the report always uses the Value field.
You may also want to consider chaning the sort order to the MonthNumber field too.

Hide SSRS chart based on multivalue parameter

Good Afternoon,
I have a multivalue parameter where if the last value in the array has the value "Reentry", it should always display the report. However, if the last value in the array is not "Reentry" it should hide the chart because it doesn't apply to the other choice. The choices are Corrections, Reentry and All. I applied the following expression to the visibility option of the target chart.
=IIf((Parameters!Division.Value(Parameters!Division.Count-1)="Reentry"), True, False)
This is showing the report for all cases, even when I select only Corrections which is the value that appears in a textbox where I placed this expression, being the last value in the array.
=Parameters!Division.Value(Parameters!Division.Count-1)
I have tried all kinds of other ways to get this to work and I have been stuck for a day. I think this approach is the easiest but it is always showing the chart, no matter what is selected. Any thoughts? This shouldn't be so difficult...thanks in advance!
Try using this expression:
=IIF(
Array.IndexOf(Parameters!Division.Value,"Reentry")=
Parameters!Division.Count-1,True,False
)
Let me know if this helps.

show/hide columns in SSRS report 2012 based on Multiselect parameter

i have been trying to hide/show columns within my tablix based on multi value parameter , but whenever i am plugging in the expression in the column visibility properties it is not showing what i select from the parameter and hide what is not select.
Here is the expression:
=IIF(InStr(JOIN(Parameters!parameter.Value,", "),"value"),false,true)
any help???
If I understand correctly, you want to show the column if you select a value which contains "value". Right?
So the expression should be like below:
=IIF(InStr(JOIN(Parameters!parameter.Value,","),"value")>0,false,true)
I always get this wrong too. I think backwards. It is actually asking for the expression that will hide the column. SO Black_T is correct with his answer.
=IIF(InStr(JOIN(Parameters!Parameter.Value,","),"value")>0,false, true)
so whenever the expression picks up that value in the statement, it will return false, meaning that it should not hide it, and whenever it doesn't find it, well the returned product will also hide it! pretty ingenious!
Thanks and enjoy!
=IIF(InStr(JOIN(Parameters!parameter.Value,","),"value")>0,true,false)

How to get one fields value with different colors based on another fields value in ssrs expression

I have to color one field based on the value of another field.
Here is an example:
Textbox 10 should display field A.
The color of the text in Textbox 10 is based on the value of field B.
I see how I can change the color of Textbox 10 based on the value of field A, but I do not know how to have the color set based on the value of another field.
What is the code that I need to put into the SSRS expression for textbox 10?
You can reference any field that's in scope or that can be reached from your current scope. Use something like this for the color property of Textbox 10:
=IIF(Fields!FieldB.Value > 5, "#FF0000", "#00FF00")
Enter the expression that references other fields, in the color property.

Stripline Background colour based on data

I have a chart which measures volume (y-axis) against date (x-axis). I have an Event table, which stores meaningful events, which I'd like to display as a vertical stripline on the chart. When there's data there, the field E_Text will be populated.
I've tried various methods, and am currently trying to only display using a change to the background colour, as such ("#00ffffff" is no colour):
=iif(Fields!E_Text.Value="","#00ffffff","Orange")
However, this statement always returns true, despite the data always being there. Has anyone managed to get data-driven striplines working?
Are you certain you are capturing nulls? A blank is something. NULL and (blank) are two different things. In SSRS Null is captured with Isnothing(), putting a value inside the parentheses. I have never had tried data driven strip lines with this method but this in the past has been an issue. Also can you test your function with an easier test first? EG: Set a simple dataset up and set the background color up with a dataset we know to have a null and a positive value:
Create test dataset
declare #Person Table ( person varchar(8), orders int);
insert into #Person values ('Brett', 10),('Sean', null)
select * from #Person
Put a table from the toolbox in and populate it with the two columns.
Set the background property of the [orders] column cell to
=iif( isnothing(Fields!orders.value), "White", "Red")
I now see a white and a red, HOWEVER if I do this:
=iif( Fields!orders.value = "", "White", "Red")
I get always white.