What is the difference between ISNULL() and ISEMPTY() function in vDesigner2.0?

  1. ISNULL():
  • Checks if the value is null.
  • A value is considered null if it has not been initialized or explicitly set to null.
  • Applies to arrays: An array is null if it does not exist in memory (i.e., it’s not initialized or points to a null reference).
  1. ISEMPTY():
  • Checks if the value exists (is not null) but contains no meaningful data.
  • For arrays, it means the array exists in memory, but its length is 0 (i.e., it has no elements).
  • Applies to arrays: An array is empty if it has been initialized but contains no elements (length == 0).
Data Type Value ISNULL() ISEMPTY()
String null true false
"" (empty string) false true
"hello" false false
Array null true false
[] (empty array) false true
[1, 2, 3] false false
Object null true false
{} (empty object) false true
{"key": "value"} false false

Key Points to Remember:

  1. ISNULL checks for the absence of a value (null reference).
  2. ISEMPTY checks for the presence of a value but verifies if it contains meaningful data (e.g., length is 0 for arrays, no keys for objects, or empty for strings).
  3. ISNULL is always checked before ISEMPTY because a null value cannot be empty.
2 Likes