isnotnull()

The isnotnull() function checks whether the value passed as an argument is not null and returns a boolean.

Syntax

isnotnull(EXPR)

Parameters

EXPR
A field name or expression to check for null.

Description

The isnotnull() function returns true if the result of evaluating EXPR is not null, and false if it is null.

The return value is always the opposite of isnull(EXPR).

Error codes

N/A

Usage examples

To prepare the WEB_APACHE_SAMPLE table used in these examples, refer to Preparing sample data.

  1. Checking the method field, which has a value

    table limit=5 WEB_APACHE_SAMPLE | eval result = isnotnull(method) | fields method, result
    | # result: true
    
  2. Checking a null value

    json "{'val': null}" | eval result = isnotnull(val)
    | # result: false
    
  3. Checking a nonexistent field

    json "{}" | eval result = isnotnull(val)
    | # result: false
    

Compatibility

The isnotnull() function has been available since before Sonar 4.0.