0
votes

I have an SSRS report, which has rows of exam results, exam name in one column, result in the other. If the exam name column contains a specific exam name I'd like to show an image, however, it seems to hide all the time when using the following show/hide

=iif(Fields!txtResultName.Value = "VR*",True,False)

It seems to always hide weather the VR record is there or not.

The design view looks like this:

Design View

I also have the following visibility expression on the 2nd row to hide the 'VR*' exam or any other exam if no results exists.

=iif(len(Fields!txtResult.Value) = 0,True,False)
2

2 Answers

1
votes

So first question, you want the image to be visible when txtResultName begins with VR? Because SSRS is a little weird with visibility in that you are actually setting the expression for Hidden -- meaning when the conditional evaluates to the true result, the object is hidden. I'm guessing you want to reverse the true and false values. Secondly, you should be able to use the Contains or InStr to get this working correctly.

= IIF(Fields!txtResultName.Value.Contains("VR"), False, True)

Or with InStr:

=IIF(InStr(Fields!txtResultName.Value, "VR") > 0, False, True)

Contains simply searches the entire string for the characters VR and shows the image when the characters are found. InStr searches for the same characters but returns a value indicating the position in the string where the characters appear -- so any value greater than zero indicates that they are present in the string.

0
votes

Thanks, Steve, final solution below:

=iif(max(iif(Fields!txtResultName.Value="VR*", Fields!txtResult.Value,nothing)) = nothing, true, false)