Nifi UpdateAttribute not working for dynamic variable

1.5k Views Asked by At

I am trying to get the count of files processed by ListHDFS, so the flow looks like this:

ListHDFS -> UpdateAttribute -> LogAttribute

I configured UpdateAttribute as per documentation (see attachment). Strangely, I am not even seeing "fileCount" in "view data provenance" option.

enter image description here

What am I missing?

1

There are 1 best solutions below

0
notNull On BEST ANSWER

I am able to see fileCount attribute value as 1 in data provenance,

I have recreated your scenario as

Generateflowfile --> UpdateAttribute --> LogAttribute

UpdateAttribute configs:

fileCount ${getStateValue("fileCount"):plus(1)}

Stateful Variables Initial Value 0

Provenance for the file: enter image description here

Initial value for the fileCount attribute is null(no value) and in UpdateAttribute we are adding one to the fileCount attribute and the new value is 1.