Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Who agreed with this solution

avatar
Super Mentor

Hello @girish6,

 

NiFi Expression language does have a function that will increment a number, but it does not reset back to zero (unless you restart NiFi) and is incremented globally across call calls to that function.

 

Screen Shot 2019-10-10 at 12.37.15 PM.png

 

So while this function will give each FlowFile a unique filename per NiFi node, there is no guarantee that they will be sequential or will start at 0 for new source zip file you extract.  If this works for your use case the NiFi Expression language statement would look like this in the UpdateAttribute processor:
Screen Shot 2019-10-10 at 12.44.10 PM.png

If you are just looking for filename uniqueness, a better solution may be to instead append the FlowFile's uniquely assigned UUID to the filename instead as follows:
Screen Shot 2019-10-10 at 12.46.25 PM.png

 

Tips: 
1. There is an expression language guide in the embedded help of your NiFi installation found by clicking on the global menu icon in upper right corner.
2. Within a NiFi processor property that support NiFi EL you can display a list of functions with details by typing "${" (signifies start of an EL statement) and then hold "Control" while clicking space bar.  This also works if you are mid statement and type ":"then "control" + click spacebar.

Examples:
file-${   (then cntrl+spacebar)
${uuid:  (then cntrl+spacebar)

Hope this helps,
Matt

View solution in original post

Who agreed with this solution