<?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: How to send a attribute to downstream processor and use it in JoltTransformJSON in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-send-a-attribute-to-downstream-processor-and-use-it/m-p/376485#M242936</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/71250"&gt;@SandyClouds&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;The "Jolt Specification" property in the &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.23.2/org.apache.nifi.processors.standard.JoltTransformJSON/index.html" target="_self"&gt;JoltTransformJson&lt;/A&gt; processor supports NiFi Expression Language (&lt;STRONG&gt;will be evaluated using flow file attributes and variable registry&lt;/STRONG&gt;).&amp;nbsp; This means that any attribute present on the FlowFile passed to the JoltTransform processor can be used in the spec.&amp;nbsp; &amp;nbsp;So if you have an upstream processor adding an attribute to your FlowFile with the attribute name "&lt;SPAN&gt;&lt;STRONG&gt;customer_id&lt;/STRONG&gt;", you can simply use &lt;A href="https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html" target="_self"&gt;NiFi Expression Language&lt;/A&gt; in your spec to pull in that attributes value.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;NiFi Parameters are defined using "#{&amp;lt;parameter name&amp;gt;}" which will look up that parameter in the parameter context defined on the NiFi Process Group and return its value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html" target="_self"&gt;NiFi Expression language&lt;/A&gt; is defined by starting with "${" and ending with "}".&amp;nbsp; Between that you can bring in an attributes value, apply NiFi Expression Language functions against an attributes value, etc.&amp;nbsp; Simplest NiFi Expression Language statement would be "${customer_id}", which will look for an attribute in the FlowFile being processed and return its value.&amp;nbsp; We refer to "customer_id" as the "subject" in that NiFi EL. NiFi EL does have a bunch of subjectless functions like "now()" that you are using, but more typical use cases start with a subject (FlowFile attribute).&amp;nbsp; I strongly encourage you to read through the linked NiFi EL guide to help you better understand the complexity and many ways you can used NiFi EL statements.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If you found any of the suggestions/solutions provided helped you with your issue, please take a moment to login and click "&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Accept as Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;" on one or more of them that helped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;BR /&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Sep 2023 14:00:52 GMT</pubDate>
    <dc:creator>MattWho</dc:creator>
    <dc:date>2023-09-19T14:00:52Z</dc:date>
    <item>
      <title>How to send a attribute to downstream processor and use it in JoltTransformJSON</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-send-a-attribute-to-downstream-processor-and-use-it/m-p/375883#M242689</link>
      <description>&lt;P&gt;I had a flow which needs to be replicated for 100 jobs.&lt;/P&gt;&lt;P&gt;one of my jolt transform looks like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[{
  "operation": "default",
  "spec": {
    "*": {
      "id": "#{customer_id_1}",
      "warehouse_loaddate" : "${now():format('yyyy-MM-dd HH:mm:ss', 'CET')}"
    }
  }
}]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The customer_id_1 is a parameter currently, which is different in all 10 different jobs.&amp;nbsp; like there are many different parameters in the context like&amp;nbsp;&lt;/P&gt;&lt;P&gt;customer_id_2&lt;/P&gt;&lt;P&gt;customer_id_3 etc..&lt;/P&gt;&lt;P&gt;With this I need to touch my code at 100 different places...&lt;/P&gt;&lt;P&gt;But since I know the customer ID is present in my upstream processor.. so I just want to name the parameter customer_id and get the value from upstream dynamically... Is there a way that I can send a attribute to downstream processor and use it in jolt ?&lt;/P&gt;&lt;P&gt;Without using parameters from parameter context ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;We use #{&amp;lt;id&amp;gt;} and ${&amp;lt;func&amp;gt;} to access parameters and Functions.. but how can i refer an attribute from my upstream processor ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me understand this.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2023 14:12:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-send-a-attribute-to-downstream-processor-and-use-it/m-p/375883#M242689</guid>
      <dc:creator>SandyClouds</dc:creator>
      <dc:date>2023-08-31T14:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to send a attribute to downstream processor and use it in JoltTransformJSON</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-send-a-attribute-to-downstream-processor-and-use-it/m-p/376485#M242936</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/71250"&gt;@SandyClouds&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;The "Jolt Specification" property in the &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.23.2/org.apache.nifi.processors.standard.JoltTransformJSON/index.html" target="_self"&gt;JoltTransformJson&lt;/A&gt; processor supports NiFi Expression Language (&lt;STRONG&gt;will be evaluated using flow file attributes and variable registry&lt;/STRONG&gt;).&amp;nbsp; This means that any attribute present on the FlowFile passed to the JoltTransform processor can be used in the spec.&amp;nbsp; &amp;nbsp;So if you have an upstream processor adding an attribute to your FlowFile with the attribute name "&lt;SPAN&gt;&lt;STRONG&gt;customer_id&lt;/STRONG&gt;", you can simply use &lt;A href="https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html" target="_self"&gt;NiFi Expression Language&lt;/A&gt; in your spec to pull in that attributes value.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;NiFi Parameters are defined using "#{&amp;lt;parameter name&amp;gt;}" which will look up that parameter in the parameter context defined on the NiFi Process Group and return its value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html" target="_self"&gt;NiFi Expression language&lt;/A&gt; is defined by starting with "${" and ending with "}".&amp;nbsp; Between that you can bring in an attributes value, apply NiFi Expression Language functions against an attributes value, etc.&amp;nbsp; Simplest NiFi Expression Language statement would be "${customer_id}", which will look for an attribute in the FlowFile being processed and return its value.&amp;nbsp; We refer to "customer_id" as the "subject" in that NiFi EL. NiFi EL does have a bunch of subjectless functions like "now()" that you are using, but more typical use cases start with a subject (FlowFile attribute).&amp;nbsp; I strongly encourage you to read through the linked NiFi EL guide to help you better understand the complexity and many ways you can used NiFi EL statements.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If you found any of the suggestions/solutions provided helped you with your issue, please take a moment to login and click "&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Accept as Solution&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/EM&gt;" on one or more of them that helped.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you,&lt;BR /&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 14:00:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-send-a-attribute-to-downstream-processor-and-use-it/m-p/376485#M242936</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2023-09-19T14:00:52Z</dc:date>
    </item>
  </channel>
</rss>

