Less Than

Last updated on
20 November 2022

Available configuration keys:

  • value: (one of value or property is required) The literal value to which to compare the source.

  • property: (one of value or property is required) The source or destination property key to 'get' and to compare the source.

  • negate: (optional) Whether to negate the 'less_than' condition. Defaults to FALSE. You can also negate the 'less_than' plugin by using 'not:less_than' 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 negative

process:
  skip_on_negative:
    plugin: skip_on_condition
    source: source_value
    condition:
      plugin: less_than
      value: 0
    method: row
    message: 'source_value was negative'

 2. Evaluate if a value is less than or equal to zero

process:
  not_positive:
    plugin: evaluate_condition
    source: source_value
    condition:
      plugin: or
      conditions:
        -
          plugin: less_than
          value: 0
        -
          plugin: equals
          value: 0

 3. Filter negative numbers out of an array

That is, keep numbers that are not less than zero. 

process:
  non_negative_values:
    plugin: filter_on_condition
    source: source_values
    condition:
      plugin: not:less_than
      value: 0

Help improve this page

Page status: No known problems

You can: