Search code examples
variablesapache-nifievaluate

Nifi - set one variable based on another variable


enter image description hereI have an evaluateJsonPath processor that sets a variable based on Json content. Based on the value the variable is set to, I want to set the value of another variable. So,

if variableA = "cat" then
   variableB = "meow"

if variableA = "dog" then
   variableB = "woof"

How do I do this?


Solution

  • Use UpdateAttribute processor's Advanced usage.

    Check the variable value using Nifi Expression language equals function and add the variable to the flowfile.

    Refer to this link for in detailed configuring/usage of UpdateAttribute processor.