reporting-services Check for NULL or Blank Check for NULL or Empty fields - shortcut

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

To get a shorter version of the Null or Empty check, use an "= Nothing" comparison.

Iif(Fields!UserEmail.Value = Nothing, "Null or Empty", "Not Null or Empty")

The "= Nothing" will check simultaneously against Null or Empty, giving a more compact expression. This works for String, Numeric, and Boolean. From MSDN:

Nothing represents the default value of a data type. The default value depends on whether the variable is of a value type or of a reference type.
A variable of a value type directly contains its value. Value types include all numeric data types, Boolean, Char, Date, all structures, and all enumerations. A variable of a reference type stores a reference to an instance of the object in memory. Reference types include classes, arrays, delegates, and strings. For more information, see Value Types and Reference Types.
If a variable is of a value type, the behavior of Nothing depends on whether the variable is of a nullable data type. To represent a nullable value type, add a ? modifier to the type name. Assigning Nothing to a nullable variable sets the value to null.

String will equate to Nothing if they are null or the empty string "".

Numerics will equate to Nothing if they are 0.

Booleans will equate to Nothing if they are False.

For a full list of the types and default values, check the (current) MSDN pages for Nothing.



Got any reporting-services Question?