Statement Action

The statement action allows you to apply different actions or set different values based on a set of conditions (also known as a “when” clause). In this case, the “when” clause is a string containing a regular expression, rather than a dictionary containing field-operator-value or field-operator-context pairs.

Here’s an example of how you might use the statement action in a YAML file:

actions:
  when_field_equals_value:
    action: statement
    when:
      field: CODE
      operator: EQUALS
      value: "ABC123"
    then:
      field: TYPE
      value: "ABC_TYPE"

In this example, the statement action will check the value of the CODE field. If it equals “ABC123”, then the TYPE field will be set to “ABC_TYPE”. If the value of the CODE field does not equal “ABC123”, then the TYPE field will not be changed.

Here’s an example of how you might use the statement action with a regular expression in the “when” clause:

actions:
  when_a_value_is_non_numeric_metric:
    action: statement
    when: 'VALUE_NL IS_NOT_NUMERIC AND VALUE_NL != - AND UOM NOT_EMPTY'
    then:
      field: TYPE
      value: "NON_NUMERIC_METRIC"

In this example, the statement action will check the values of the VALUE_NL, VALUE_NL, and UOM fields against the regular expression in the “when” clause. If the regular expression evaluates to True, then the TYPE field will be set to “NON_NUMERIC_METRIC”. If the regular expression evaluates to False, then the TYPE field will not be changed.