- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to capture number 0 in RouteOnAttribute
- Labels:
-
Apache NiFi
Created on
11-11-2019
06:00 AM
- last edited on
11-11-2019
12:29 PM
by
ask_bill_brooks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a requirement where-in I have to take a count(*) using selecthiveQL and if count is 0 then I have to insert a row.
My flow is selectHive QL → RouteOnAttribute where in I am trying to capture the 0
Json is as below:
[ {
"_c0" : 0
} ]
can some one please tell me how to capture this zero, I tried multiple ways but not able to.
Also if anyone has better solution pls let me know. This is quite urgent.
Created 11-12-2019 09:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use EvaluateJsonPath processor to extract the 0 from the json you shared
You can name the custom property added above to whatever you like (I just used C0).
This will result in a "C0" attribute being generated on the FlowFile with a value of "[0]".
If you don't wan the square brackets around the number, you can remove them using an updateAttribute processor as follows:
Then you can perform your routing with the RouteOnAttribute processor.
Hope this helps,
Matt
Created 11-12-2019 09:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use EvaluateJsonPath processor to extract the 0 from the json you shared
You can name the custom property added above to whatever you like (I just used C0).
This will result in a "C0" attribute being generated on the FlowFile with a value of "[0]".
If you don't wan the square brackets around the number, you can remove them using an updateAttribute processor as follows:
Then you can perform your routing with the RouteOnAttribute processor.
Hope this helps,
Matt
