SSRS Report Shows a White Space In Textboxes for NULL Values But I Want an Empty String Instead

StackOverflow https://stackoverflow.com/questions/21585900

  •  07-10-2022
  •  | 
  •  

Question

I have a grid with a lot of rows and columns to display data for a report.

Each cell in the grid is represented by a textbox and I am trying to show a blank or empty string in my textboxes to represent a NULL values instead of the default white space. The reason behind is that each textbox value has been underlined to show to the user that it is a link they can click on. A white space in the cell now represents an underscore and replacing the whitespace by blank or an empty string should hopefully solve the issue.

Answers on stackoverflow suggest to set the visibility of the textbox to false but I don't want to do this because this would hide the cell in the grid and I want to show the cells (empty cell with borders).

Here is the code I use to attempt to replace Nothing by an empty string but it doesn't work:

=IIf(IsNothing(Fields!HattyAppsLateOver60.Value),"",Fields!HattyAppsLateOver60.Value)

I have tried using the Trim() method but that doesn't work either.

Is there a way to globally make white spaces show as an empty string or is there a method I could use in my expression to solve my issue?

Was it helpful?

Solution

I would use something like the following expression to drive the TextDecoration property:

=IIf( Fields!HattyAppsLateOver60.Value <> "", "Underline", "Default" )

OTHER TIPS

Can you just modify your query to have something like:

select field1, field2, coalesce(field3,''), field4 from myTable where condition=true

The coalesce function takes multiple parameters and will return the first non-null value. So you could do something like Coalesce(field1, field2, field3, '') terminating with an empty string to make sure that you guarantee at least one of the options has a non-NULL value.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top