Created 07-12-2017 06:37 PM
Hi All, I want to route flowfiles in nifi on comparison of a field value in flowfile with a constant date value. eg i have a lastupdatedate field in my flowfile, i want to route all flowfiles to matched if lastupdatedate (format is '2017-03-12 06:07:12:01') is greater than '2017-07-31'. i am using routeonattribute processor. i formatted lastupdatefield as : ${d_last_updt:toDate('yyyy-MM-dd'):format('yyyyMMdd')} and then compared this value with the constant value (converting it to same format), but it seems the functions are not routing the flowfiles. please suggest where i am going wrong? Thanks in advance!!!!
Created 07-31-2017 12:37 PM
@sri chaturvedi Please try converting both the variables to String datatype before comparison. Sample: ${d_last_updt:toDate('yyyy-MM-dd'):format('yyyyMMdd'):toString():gt(constant value:toString())}
Hope this helps
Created 11-01-2017 12:59 PM
Thanks Ramasamy..i will try this.
Created on 11-02-2017 01:13 AM - edited 08-18-2019 01:26 AM
if you are having d_last_updt attribute value as 2017-03-12 06:07:12:01 then in Route On Attribute processor add new property as
${d_last_updt:toDate('yyyy-MM-dd'):format('yyyyMMdd'):gt('20170731')} //todate extracts year month date from your lastupdatedate attribute and formats as yyyyMMdd then give your value in gt function.
This property checks all d_last_updt attribute value if the value is greater than 20170731 if attribute value satisfies the condition then it routes to property name relation , if not it routes to unmatched relation.
Route on Attribute processor Configs:-