ozw1z5rd
ozw1z5rd

Reputation: 3208

Nifi Expression Language how to assign a value to a variable

I'm using Nifi's Expression Language to compute 2 dates in order to stick them into a template. I like compute these dates ONCE and to use them into the template as much as I need. My Idea is to do something like:

dateStart = ${now():toNumber():minus(86400):format("YYYY-MM-dd'T'hh:mm:'00'")} 

then use ${dateStart} as I like

How can I assign the expression result to a var ?

Upvotes: 2

Views: 6816

Answers (2)

Rodrigo Koga
Rodrigo Koga

Reputation: 1

You can use a generateFlowFile with this property:

enter image description here

Upvotes: 0

Bryan Bende
Bryan Bende

Reputation: 18670

The UpdateAttribute processor is used to add attributes to flow files. From the configuration screen of UpdateAttribute you can click the + icon in the top right to add a property and name it "dateStart" and set the value to your expression. After that you can reference ${dateStart} in other processor properties that support expression language.

Upvotes: 5

Related Questions