Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nifi expression concat text in filename

Tags:

apache-nifi

I have created a RouteOnAttribute processor in nifi dataflow, i want it to select only certain files to parse on. in the properties i have created a property "filetofetch" with following expression

${filename:contains('INCOMING.D151221') 

I need to fetch the file name INCOMING.D< YYYYMMDD> so today 21 MARTS 2017 the filename would be

INCOMING.D20170321

I have tried with something like this to extraxt file name

${filename:contains('INCOMING.D'+ ${now():format('yyyymmdd')} )}

But i cannot concat with the date prefix any suggestions ?

like image 636
havmaage Avatar asked Aug 30 '25 16:08

havmaage


1 Answers

Havmaage,

You can concat by use append in Expression language like below.,

You have to use the updateAttribute to store the 'Incoming.D' in one attribute name like below.

   fileStartsWith:Incoming.D
   Date:${now():format('yyyyMMdd')

Then finally use routeonattribute to check like below.

    ${filename:contains(${fileStartsWith:append(${date})})}

You cann't be concat with '+' in Nifi.

EDIT-1:

  Date:${now():format('yyyyMMdd')
like image 188
Mister X Avatar answered Sep 02 '25 11:09

Mister X