- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
NiFi Expression - Multiple OR - AND Conditions
- Labels:
-
Apache NiFi
Created ‎09-18-2018 07:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am using RouteONAttribute Processor and i defined a property and its value contains multiple OR and AND conditions like the following:
Property Name: ROUTE1
Property Value:
${text.tag.type:equals('XXX'):and(${txt:contains('YES')}):or(${text.tag.type:equals('YYY')}):and(${txt:contains('NO')})}
The Issue i am facing is that after generating a flow file with attributes text.tag.type = XXX and txt = YES CORRECT it always route to unmatched while it should route to ROUTE1
Thanks ...
Created on ‎09-19-2018 01:01 AM - edited ‎08-18-2019 12:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Method1:Using UpdateAttribute+RouteOnAttribute Processors
it would be easier if you introduce new update attribute processor before RouteOnAttribute and prepare two new attributes in UpdateAttribute processor.
Configs:
Then in RouteOnAttribute processor use or function to
Configs:
Now processor will route the flowfile to ROUTE1 relationship.
(or)
Method2: By using RouteOnAttribute processor:
Use the below expression in ROUTE1 property value
ROUTE1
${literal(${text.tag.type:equals('XXX'):and(${txt:contains('YES')})}):or(${text.tag.type:equals('YYY'):and(${txt:contains('NO')})})}
Both Methods will result the flowfile into ROUTE1 relationship, Choose the method which best for your case.
-
If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.
Created on ‎09-19-2018 01:01 AM - edited ‎08-18-2019 12:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Method1:Using UpdateAttribute+RouteOnAttribute Processors
it would be easier if you introduce new update attribute processor before RouteOnAttribute and prepare two new attributes in UpdateAttribute processor.
Configs:
Then in RouteOnAttribute processor use or function to
Configs:
Now processor will route the flowfile to ROUTE1 relationship.
(or)
Method2: By using RouteOnAttribute processor:
Use the below expression in ROUTE1 property value
ROUTE1
${literal(${text.tag.type:equals('XXX'):and(${txt:contains('YES')})}):or(${text.tag.type:equals('YYY'):and(${txt:contains('NO')})})}
Both Methods will result the flowfile into ROUTE1 relationship, Choose the method which best for your case.
-
If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.
Created ‎03-28-2019 11:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
can i use this with filename i mean i would like to filename after validating two conditions in RouteONAttribute
${filename:contains("csv.done")}:and ${filename:contains(".csv")}
