If field is NOT null, then hide an object (SSRS Expression)
Asked Answered
B

3

5

I have a rectangle.

I want to hide it if a field (X) is NOT NULL.

I tried this but it is not working:

=IIF(NOT IsNothing(Fields!filepath.Value), 1, 0)

I get the error:

An error occurred during local report processing.

The Hidden expression used in rectangle 'ID2398' returned a data type that is not valid.

Anyone know why I'm having this issue?

Do I need to place the actual field onto the report? I tried it but I keep getting the same error.

Bombsight answered 22/4, 2015 at 0:26 Comment(0)
B
15

If you're using that for the Visibility expression, I believe you need to explicitly use True/False rather than 1 or 0. So try:

=IIF(NOT IsNothing(Fields!filepath.Value), True, False)
Bashkir answered 22/4, 2015 at 0:57 Comment(0)
K
0

I do prefer to use =iff(Fields!filepath.Value IsNot Nothing, Fields!filepath.Value, ) in Textbox/Properties/Visibility/Hide as it is more intuitive for me.

Kohinoor answered 24/5, 2020 at 14:2 Comment(0)
G
0

For a similar but different project, I wanted to hide my text if it was null, but if it had a value, then show it with a prefix in front of it. and no, I could not just simply use the cell or row visibility, because then it removed the border outline. I used:

=IIF(IsNothing(Fields!CustPN.Value),"",
IIF(NOT IsNothing(Fields!CustPN.Value),
"Cust PN: " & Fields!CustPN.Value,""))
Glanders answered 1/7 at 19:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.