<?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: Possible RecordPath to fetch data from a list based on a condition in NiFi in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Possible-RecordPath-to-fetch-data-from-a-list-based-on-a/m-p/386665#M246104</link>
    <description>&lt;P&gt;Hello Ma'am,&lt;BR /&gt;&lt;BR /&gt;This recordPath would work-&lt;BR /&gt;../goodIdentifications[*][./goodIdentificationTypeId = "SKU"]/idValue&lt;BR /&gt;&lt;BR /&gt;[*] is used to iterate a list and * is used to refer to all the keys of a map in RecordPath.&lt;/P&gt;</description>
    <pubDate>Tue, 16 Apr 2024 20:52:20 GMT</pubDate>
    <dc:creator>nidhipal</dc:creator>
    <dc:date>2024-04-16T20:52:20Z</dc:date>
    <item>
      <title>Possible RecordPath to fetch data from a list based on a condition in NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Possible-RecordPath-to-fetch-data-from-a-list-based-on-a/m-p/386656#M246099</link>
      <description>&lt;P&gt;Hi Everyone,&lt;BR /&gt;I am trying to perform some data transformations using UpdateRecord processor.&lt;BR /&gt;The input format is a nested JSON, and I am able to perform shifting of some fields using RecordPath.&lt;BR /&gt;But facing issues when preparing a field using some conditional logic from a nested list.&lt;/P&gt;&lt;P&gt;Here is my scenario:&lt;BR /&gt;Input JSON&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  {
    "orderId": "1234",
    "orderName": "Order 1",
    "orderItems": [
      {
        "orderItemSeqId": "01",
        "itemStatusId": "ITEM_APPROVED",
        "orderItemQuantity": 1,
        "unitPrice": 149,
        "goodIdentifications": [
          {
            "goodIdentificationTypeId": "SHOPIFY_PROD_ID",
            "idValue": "43623074824370"
          },
          {
            "goodIdentificationTypeId": "SKU",
            "idValue": "2510524-4BB-S"
          },
          {
            "goodIdentificationTypeId": "UPCA",
            "idValue": "2510524-4BB-S"
          }
        ]
      },
      {
        "orderItemSeqId": "02",
        "itemStatusId": "ITEM_APPROVED",
        "orderItemQuantity": 1,
        "unitPrice": 159,
        "goodIdentifications": [
          {
            "goodIdentificationTypeId": "SHOPIFY_PROD_ID",
            "idValue": "43623074824370"
          },
          {
            "goodIdentificationTypeId": "SKU",
            "idValue": "2510524-4BB-S"
          },
          {
            "goodIdentificationTypeId": "UPCA",
            "idValue": "2510524-4BB-S"
          }
        ]
      }
    ]
  }
]&lt;/LI-CODE&gt;&lt;P&gt;The output expected is below:&lt;BR /&gt;- New field "itemSku" should be added to each object of orderItems list which is fetched from the goodIdentifications list with goodIdentificationTypeId as SKU.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Expected Output JSON&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  {
    "orderId": "1234",
    "orderName": "Order 1",
    "orderItems": [
      {
        "orderItemSeqId": "01",
        "itemStatusId": "ITEM_APPROVED",
        "orderItemQuantity": 1,
        "unitPrice": 149,
        "goodIdentifications": [
          {
            "goodIdentificationTypeId": "SHOPIFY_PROD_ID",
            "idValue": "43623074824370"
          },
          {
            "goodIdentificationTypeId": "SKU",
            "idValue": "2510524-4BB-S"
          },
          {
            "goodIdentificationTypeId": "UPCA",
            "idValue": "2510524-4BB-S"
          }
        ],
        "itemSku": "2510524-4BB-S"
      },
      {
        "orderItemSeqId": "02",
        "itemStatusId": "ITEM_APPROVED",
        "orderItemQuantity": 1,
        "unitPrice": 159,
        "goodIdentifications": [
          {
            "goodIdentificationTypeId": "SHOPIFY_PROD_ID",
            "idValue": "43623074824371"
          },
          {
            "goodIdentificationTypeId": "SKU",
            "idValue": "2510524-4BB-T"
          },
          {
            "goodIdentificationTypeId": "UPCA",
            "idValue": "2510524-4BB-T"
          }
        ],
        "itemSku": "2510524-4BB-T"
      }
    ]
  }
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to know if performing such conditional logic is possible and what could be the possible RecordPath to prepare this field??&lt;/P&gt;&lt;P&gt;Tried something like,&amp;nbsp;&lt;BR /&gt;Added new property in UpdateRecord.&lt;BR /&gt;Property - /orderItems[*]/itemSku&lt;BR /&gt;&lt;SPAN&gt;Value - ../goodIdentifications[./goodIdentificationTypeId = ‘’SKU"]/idValue&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;But this doesnt seem to work.&lt;BR /&gt;&lt;SPAN&gt;Any help would be appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 19:05:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Possible-RecordPath-to-fetch-data-from-a-list-based-on-a/m-p/386656#M246099</guid>
      <dc:creator>gurveen</dc:creator>
      <dc:date>2024-04-16T19:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Possible RecordPath to fetch data from a list based on a condition in NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Possible-RecordPath-to-fetch-data-from-a-list-based-on-a/m-p/386658#M246100</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/110047"&gt;@gurveen&lt;/a&gt;&amp;nbsp;Welcome to the Cloudera Community!&lt;BR /&gt;&lt;BR /&gt;To help you get the best possible solution, I have tagged our NiFi expert&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/95503"&gt;@steven-matison&lt;/a&gt;&amp;nbsp;&amp;nbsp;who may be able to assist you further.&lt;BR /&gt;&lt;BR /&gt;Please keep us updated on your post, and we hope you find a satisfactory solution to your query.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 19:28:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Possible-RecordPath-to-fetch-data-from-a-list-based-on-a/m-p/386658#M246100</guid>
      <dc:creator>DianaTorres</dc:creator>
      <dc:date>2024-04-16T19:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Possible RecordPath to fetch data from a list based on a condition in NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Possible-RecordPath-to-fetch-data-from-a-list-based-on-a/m-p/386665#M246104</link>
      <description>&lt;P&gt;Hello Ma'am,&lt;BR /&gt;&lt;BR /&gt;This recordPath would work-&lt;BR /&gt;../goodIdentifications[*][./goodIdentificationTypeId = "SKU"]/idValue&lt;BR /&gt;&lt;BR /&gt;[*] is used to iterate a list and * is used to refer to all the keys of a map in RecordPath.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 20:52:20 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Possible-RecordPath-to-fetch-data-from-a-list-based-on-a/m-p/386665#M246104</guid>
      <dc:creator>nidhipal</dc:creator>
      <dc:date>2024-04-16T20:52:20Z</dc:date>
    </item>
  </channel>
</rss>

