Support Questions

Find answers, ask questions, and share your expertise

How to compare two Arrays in Nifi ?

avatar

Input to my Nifi flow is from CDC-> Kafka
I am using ConsumeKafka processor and in the flowfile contant I have list of columns on of a table on which CDC is enabled, Based on a flag present in my flowfile-content I am getting all the column values whihc were updated in the form of an array, I am storing this array in a attribute
ex: myAttr:[123,456,789]
For each flowfile this attributes is getting generated.


Now, I have a static array which contains a list of allowed keys(this is not generated from flow file, its something  i am using to check the values in my attribute)
ex: AllowedKeys:[111,222,333,123,456,789]
I am trying to see if the values inside my attribute "myAttr"  contains only the allowed keys
if all the values in myattr is present in AllowedKeys then i want to route it to success otherwise to failure

Please let me know how can i achieve this(preferably without ExecuteScript or custom processor)

3 REPLIES 3

avatar
Contributor

Hi, this should work for you : https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#alldelineatedvalues

Hope this helps. If the comment helps you to find a solution or move forward, please accept it as a solution for other community members.

avatar

Tried with alldelineatedvalues but its not working 

Can you share if you have any flow in which it worked for you

avatar
Contributor

Hi...extremely sorry for the comment before. i thought it should work without trying it out first. I looked at it again and it seems its not possible to do it without a script.