havmaage
havmaage

Reputation: 603

nifi expression concat text in filename

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 ?

Upvotes: 4

Views: 8784

Answers (1)

Mahendran V M
Mahendran V M

Reputation: 3496

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')

Upvotes: 6

Related Questions