All Elements

Last updated on
20 November 2022

Evaluates the configured condition on each array element and returns TRUE if every element meets the condition.

Available configuration keys:

  • condition: The condition plugin to evaluate on each element. Can be either:
    • The id of the condition. This is possible if the condition does not require any configuration, such as the 'empty' condition
    • An array with a 'plugin' key that is the id of the condition. Any additional properties will be used as configuration when creating an instance of the condition.
  • negate: (optional) Whether to negate the all_elements condition. Defaults to FALSE. You can also negate the 'all_elements' plugin by using 'not:all_elements' 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.

Please note that you should never specify source on the condition that all_elements leverages. It wouldn't make any sense.

Examples

 1. Determine if all values in an array are positive

process:
  all_positive:
    plugin: evaluate_condition
    source: my_source_numbers
    condition:
      plugin: all_elements
      condition:
        plugin: greater_than
        value: 0

2. Skip a row if all source dates are in the past

process:
  skip_if_everything_is_in_the_past:
    plugin: skip_on_condition
    source: my_source_dates
    condition:
      plugin: all_elements
      condition:
        plugin: older_than
        format: 'j M Y' #the format of the source dates
        value: 'now'
    method: row
    message: 'All the dates are old.'

Help improve this page

Page status: No known problems

You can: