Is Null

Last updated on
20 November 2022

Available configuration keys: 

  • negate: (optional) Whether the 'is_null' condition should be negated. Defaults to FALSE. You can also negate the 'is_null' plugin by using 'not:is_null' as the plugin id.
  • source: (optional) Property or array of properties on which to evaluate the condition. If not set, the condition will be evaluated on the source passed to the ::evaluate() method, typically the source of the process plugin that is using this condition.

Examples

1. Skip a row if a source value is null

Maybe you can't use skip_on_empty because you want to allow zero (0) or false or something.

process:
  skip_null:
    plugin: skip_on_condition
    condition: is_null
    source: source_value
    method: row
    message: 'the source_value was null'

 2. Re-create the core null_coalesce process plugin

process:
  some_not_null_value:
    plugin: first_meeting_condition
    condition: not:is_null
    source:
      - some_value
      - another_value
      - yet_another
    default_value: 'If all else fails...'

3. Remove null values from an array

That is, we keep values that are not null.

process:
  array_with_no_nulls:
    plugin: filter_on_condition
    source: my_source_array
    condition: not:is_null
    preserve_keys: true

Help improve this page

Page status: No known problems

You can: