I am working with Rdlc report. I have these fields:
First name
Address1
Address2
City, state, zip
If any one of these fields is empty, it should not show the blank space. For example (expected output)
First name,
Address1,
City, state, zip
But, as show in the above image, I am getting this:
First name,
Address1,
........................<-(blankspace is showing here)
City, state, zip
I tried changing Visiblity
-> Expression
->
=IIF(String.IsNullOrEmpty(Fields!Address2.Value), false,True)
I think that the expression with String.IsNullOrEmpty
didn't works.
Try with one of this two options:
1.=IIF(IsNothing(Fields!Address2.Value),False,True)
2.=IIF(Len(Fields!Address2.Value) = 0,False,True)
According to the comments, the solution is to create a single textbox in which put two (or more) fields and concatenate the value if the second fields has a real value or is empty.
So the expression will be:
=Fields!Name.Value + System.Environment.NewLine + Fields!SAddr_Line1.Value + IIF(Len(Fields!Address2.Value) = 0, "", System.Environment.NewLine + Fields!Address2.Value) + Fields!ShipTo.Value
For more readability:
=Fields!Name.Value
+ System.Environment.NewLine
+ Fields!SAddr_Line1.Value
+ IIF(Len(Fields!Address2.Value) = 0, "", System.Environment.NewLine + Fields!Address2.Value)
+ Fields!ShipTo.Value
Just in case this helps somebody.
I suffered the same (and I had quite complex grouping on) until I did:
Fields!FieldName.Value * 1
(You can then convert to String using CStr() if needed)
And voilà!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With