I am attempting to update an attribute based on incoming properties. Essentially I need to evaluate many incoming attributes and output a list in a new attribute based on the incoming attributes.
Here is an example:
The logic is IF attribute1="T" THEN ResultingAttribute="foo,"
IF attribute2="T" THEN ResultingAttribute="bar,"
IF attribute1="T"&&attribute2="T" THEN ResultingAttribute="foo,bar,"
Does anyone know how this can be accomplished using only 1 UpdateAttribute processor?
Yes you can do that using Advance Usage,Change FlowFile Policy to use original.
These rules will be evaluated in the order they placed i.e rule1 is checked first then rule2 is checked second rule3 checked third.
you can rearrange order of evaluation by click and drag.
Let us know if you having any issues..!!
Thank you for your response. It certainly works for the simplified example I provided, but in my application it could be checking for more than 2 incoming attributes. As of now it would check for 5 attributes, and it would not be possible to add a rule for each possible combination of attributes flagged with "T."
If you feel like it will not possible to keep all combinations then other options to acheive this use case would be:
Write a script(in java,groovy..etc) and check all the combinations, write the required attributes to the flowfile.
Refer to below link for scripting cook books:-
By using Hive query:
store the data into HDFS then feed the PutHDFS processor success relation to selectHiveQL processor then run your logic by using SQL query with case statement in it then extract your required attributes from the flowfile contents.