<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Nifi RouteOnAttribute Problem in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110574#M73422</link>
    <description>&lt;P&gt;What is the JSON key of the value you are trying to extract?&lt;/P&gt;</description>
    <pubDate>Sat, 23 Apr 2016 01:52:29 GMT</pubDate>
    <dc:creator>cgambino</dc:creator>
    <dc:date>2016-04-23T01:52:29Z</dc:date>
    <item>
      <title>Nifi RouteOnAttribute Problem</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110568#M73416</link>
      <description>&lt;P&gt;Hi Does anyone know if it is by design that Nifi RouteOnAttribute on look at an attribute value that is for the entire flowfile instead of attribute value that can be different for different record in a josn file?  e.g., when RouteOnAttribute is set to find a word 'xyz'  in a json element (say msg), e.g,  properties configure to route on ${msg:find('xyz')}, it actually route entire file including records that msg does not contain xyz.  If that how it works or if the RouteonAttribute properties configuration is missing something?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shannon&lt;/P&gt;&lt;P&gt;Update: Edit to add additional information based on &lt;A rel="user" href="https://community.cloudera.com/users/2213/cgambino.html" nodeid="2213"&gt;@Chris Gambino&lt;/A&gt; and &lt;A rel="user" href="https://community.cloudera.com/users/364/jwitt.html" nodeid="364"&gt;@jwitt&lt;/A&gt; replies:&lt;/P&gt;&lt;P&gt; Data flow is design as: &lt;/P&gt;&lt;P&gt;GetSourceData --&amp;gt; some process for parsing to get a flat json --&amp;gt; EvaluateJsonPath--&amp;gt; UpdateAttribute -- &amp;gt; RouteOnAttribute&lt;/P&gt;&lt;P&gt;May be the problem is at UpdateAttribute, which has a property added to an attribute "matched_msg"  using below so that this new attribute has 1 or 0 value.&lt;/P&gt;&lt;P&gt;${msg:find('xyz'):equals('true'):replace('true', '1'):or (${tmsg:find('xyz'):equals('false'):replace('false', '0')})}&lt;/P&gt;&lt;P&gt;Above followed by RouteOnAttribute using ${matched_msg:equals(1)}&lt;/P&gt;&lt;P&gt;Results is that it ended up with entire file instead of records with the match.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 04:20:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110568#M73416</guid>
      <dc:creator>Luos</dc:creator>
      <dc:date>2016-04-22T04:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi RouteOnAttribute Problem</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110569#M73417</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Keep in mind each FlowFile is comprised of attributes and content.  &lt;/P&gt;&lt;P&gt;RouteOnAttribute is built specifically to look at FlowFile attributes.&lt;/P&gt;&lt;P&gt;RouteOnContent looks at FlowFile content.&lt;/P&gt;&lt;P&gt;In the case of JSON you can, for example, use EvaluateJSONPath to extract fields from the JSON to become FlowFile attributes.  You can use SplitJSON to split the JSON bundles into invidual flowfiles then extract values and then route on attributes.  The various processors offer you a variety of ways to route, transform, and deliver the data.&lt;/P&gt;&lt;P&gt;Thanks
Joe&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 04:25:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110569#M73417</guid>
      <dc:creator>JoeWitt</dc:creator>
      <dc:date>2016-04-22T04:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi RouteOnAttribute Problem</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110570#M73418</link>
      <description>&lt;P&gt;Hey Shannon,&lt;/P&gt;&lt;P&gt;You want to use EvaluateJsonPath to make an attribute called "msg" with the value $.msg&lt;/P&gt;&lt;P&gt;You then want to use RouteonAttribute with ${msg:equals('xyz')}  &lt;/P&gt;&lt;P&gt;You are very close to having it down correctly!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 04:35:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110570#M73418</guid>
      <dc:creator>cgambino</dc:creator>
      <dc:date>2016-04-22T04:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi RouteOnAttribute Problem</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110571#M73419</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/364/jwitt.html" nodeid="364"&gt;@jwitt, &lt;/A&gt;&lt;A rel="user" href="https://community.cloudera.com/users/2213/cgambino.html" nodeid="2213"&gt;@Chris Gambino&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Would you be so kind to take a look at updated info above (the second part of the original posting)?    I tried to simply the description in the beginning, which was a wrong call :).   May be the problem is not in the processor I originally thought.   May be UpdateAttribute was not configured right with the expression given?  In the output file, I can't see the new attribute match_msg added, which was not what I expected either.  Any ideas?&lt;/P&gt;&lt;P&gt; Thanks!&lt;/P&gt;&lt;P&gt;Shannon
&lt;A rel="user" href="https://community.cloudera.com/users/364/jwitt.html" nodeid="364"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 05:15:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110571#M73419</guid>
      <dc:creator>Luos</dc:creator>
      <dc:date>2016-04-22T05:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi RouteOnAttribute Problem</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110572#M73420</link>
      <description>&lt;P&gt;Update:   if just connect EvaluateJsonPath to RouteOnAttribute, configure it to route on ${msg:find('xyz'):equals('true')}.    The result is still the same--  getting entire file instead of the records has xyz in msg.  So, guess it is still RouteOnAttribbute is having problem.  Any help on correcting it would be greatly appreciated.&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;Shannon&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2016 05:27:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110572#M73420</guid>
      <dc:creator>Luos</dc:creator>
      <dc:date>2016-04-22T05:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi RouteOnAttribute Problem</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110573#M73421</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/364/jwitt.html" nodeid="364"&gt;@jwitt&lt;/A&gt; &lt;/P&gt;&lt;P&gt;yep-- this is the solution, EvaluateJsonPath only deals with one record at a time not a whole array.  Thanks much for pointing to the right direction!  Shannon&lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2016 00:59:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110573#M73421</guid>
      <dc:creator>Luos</dc:creator>
      <dc:date>2016-04-23T00:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi RouteOnAttribute Problem</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110574#M73422</link>
      <description>&lt;P&gt;What is the JSON key of the value you are trying to extract?&lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2016 01:52:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110574#M73422</guid>
      <dc:creator>cgambino</dc:creator>
      <dc:date>2016-04-23T01:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi RouteOnAttribute Problem</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110575#M73423</link>
      <description>&lt;P&gt;Hey &lt;A rel="user" href="https://community.cloudera.com/users/3621/sluo.html" nodeid="3621"&gt;@shannon luo&lt;/A&gt; just wanted to chime in. In your data flow design you mentioned a step where you're parsing data to get a flat json. In case that process is changing the schema of json wanted to just let you know there's an upcoming processor called TransformJSON that may be useful. It supports Jolt specifications (https://github.com/bazaarvoice/jolt) and makes it a lot easier to transform or extract json flowfile content. If that's not what you need now it may be helpful in the future working with json in NiFi.  &lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2016 03:56:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110575#M73423</guid>
      <dc:creator>ydavis</dc:creator>
      <dc:date>2016-04-23T03:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi RouteOnAttribute Problem</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110576#M73424</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/3136/ydavis.html" nodeid="3136"&gt;@Yolanda M. Davis&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Great to know. Thank you, Yolanda! &lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 01:55:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Nifi-RouteOnAttribute-Problem/m-p/110576#M73424</guid>
      <dc:creator>Luos</dc:creator>
      <dc:date>2016-04-26T01:55:47Z</dc:date>
    </item>
  </channel>
</rss>

