Null Values

Attributes in HCL Detect Expression Language are nullable, that is, attributes can take null values. To denote a null value, the null keyword is used.

Only the following actions are legal on the expressions with null values:

  • Built-in function calls: A nullable function parameter can take a null value. E.g.: the second parameter in the list.indicesOf([1, 2, null, 4, 5, null], null) call
  • Ternary operations: The values returned from choices can be null. E.g.: string.startsWith(profile.areaCode, "AREA_") ? profile.areaCode : null where areaCode is a profile attribute of the String type
  • List items: Null values can be list items. E.g.: [null, 3, 5, 6, null]
  • List containment check operations: Null values can be used on the left hand side. E.g.: null not in [null, 3, 5, 6, null]
  • Equality check operations: Null values can be compared for equality and non-equality. E.g.: MSISDN == null where MSISDN is a tuple attribute (Note: For comparisons with null values, the isNull operator can also be used. Examples: isNull(null) yields trueisNull(profile.x) yields false if the x profile attribute is not null)
  • Type conversions: The type conversion rules are similar to the ones for non-null expressions. Some examples that are legal: List(Int32)(null), Int32(null), String(Int32(null)), some examples that are illegal: List(Int32)(List(Int64)(null)), Int64(List(Int32)(null)), Bool(Int32(null)), List(Int16)(Double(null))