<?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 Extracting List Elements using JOLT in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Extracting-List-Elements-using-JOLT/m-p/390112#M247190</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you assist me in retrieving the single branchName value from&amp;nbsp;priceRuleAttributes list based on id,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When i am doing without id match its working fine and giving me single branchName value for each index but with id match its combining all values at 1st index.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Input&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "Data": {
    "ID": "09878666",
    "DATE": "2022-01-01",
    "ARRAY_ONE": [
      {
        "NAME": "test_1",
        "priceRuleAttributes": [
          {
            "type": "CFA",
            "id": "PR_BRANCH_NAME",
            "values": [
              "MEMBERS"
            ]
          },
          {
            "type": "CFA",
            "id": "PR_PRICE_RULE_PROMO",
            "valueBoolean": true
          },
          {
            "type": "CFA",
            "id": "PR_TARGET_SEGMENT",
            "values": [
              "1"
            ]
          }
        ]
      },
      {
        "NAME": "test_2",
        "priceRuleAttributes": [
          {
            "type": "CFA",
            "id": "PR_BRANCH_NAME",
            "values": [
              "NON MEMBERS"
            ]
          },
          {
            "type": "CFA",
            "id": "PR_PRICE_RULE_PROMO",
            "valueBoolean": true
          },
          {
            "type": "CFA",
            "id": "PR_TARGET_SEGMENT",
            "values": [
              "1"
            ]
          }
        ]
      }
    ]
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Spec&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  {
    "operation": "shift",
    "spec": {
      "Data": {
        "ARRAY_ONE": {
          "*": {
            "@(2,ID)": "[#2].ID",
            "@(2,DATE)": "[#2].DATE",
            "NAME": "[#2].NAME",
            "priceRuleAttributes": {
              "*": {
                "id": {
                  "PR_BRANCH_NAME": {
                    "@(2,values)": "[#4].branchName"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected Output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ {
  "ID" : "09878666",
  "DATE" : "2022-01-01",
  "NAME" : "test_1",
  "branchName" : [ "MEMBERS" ]
}, {
  "ID" : "09878666",
  "DATE" : "2022-01-01",
  "NAME" : "test_2",
  "branchName" : [ "NON MEMBERS" ]
} ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actual output&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Syed0000_0-1720659770483.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/41145i816CE8E72B20CF88/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Syed0000_0-1720659770483.png" alt="Syed0000_0-1720659770483.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jul 2024 01:09:16 GMT</pubDate>
    <dc:creator>Syed0000</dc:creator>
    <dc:date>2024-07-11T01:09:16Z</dc:date>
    <item>
      <title>Extracting List Elements using JOLT</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Extracting-List-Elements-using-JOLT/m-p/390112#M247190</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you assist me in retrieving the single branchName value from&amp;nbsp;priceRuleAttributes list based on id,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When i am doing without id match its working fine and giving me single branchName value for each index but with id match its combining all values at 1st index.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Input&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "Data": {
    "ID": "09878666",
    "DATE": "2022-01-01",
    "ARRAY_ONE": [
      {
        "NAME": "test_1",
        "priceRuleAttributes": [
          {
            "type": "CFA",
            "id": "PR_BRANCH_NAME",
            "values": [
              "MEMBERS"
            ]
          },
          {
            "type": "CFA",
            "id": "PR_PRICE_RULE_PROMO",
            "valueBoolean": true
          },
          {
            "type": "CFA",
            "id": "PR_TARGET_SEGMENT",
            "values": [
              "1"
            ]
          }
        ]
      },
      {
        "NAME": "test_2",
        "priceRuleAttributes": [
          {
            "type": "CFA",
            "id": "PR_BRANCH_NAME",
            "values": [
              "NON MEMBERS"
            ]
          },
          {
            "type": "CFA",
            "id": "PR_PRICE_RULE_PROMO",
            "valueBoolean": true
          },
          {
            "type": "CFA",
            "id": "PR_TARGET_SEGMENT",
            "values": [
              "1"
            ]
          }
        ]
      }
    ]
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Spec&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  {
    "operation": "shift",
    "spec": {
      "Data": {
        "ARRAY_ONE": {
          "*": {
            "@(2,ID)": "[#2].ID",
            "@(2,DATE)": "[#2].DATE",
            "NAME": "[#2].NAME",
            "priceRuleAttributes": {
              "*": {
                "id": {
                  "PR_BRANCH_NAME": {
                    "@(2,values)": "[#4].branchName"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected Output&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ {
  "ID" : "09878666",
  "DATE" : "2022-01-01",
  "NAME" : "test_1",
  "branchName" : [ "MEMBERS" ]
}, {
  "ID" : "09878666",
  "DATE" : "2022-01-01",
  "NAME" : "test_2",
  "branchName" : [ "NON MEMBERS" ]
} ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actual output&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Syed0000_0-1720659770483.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/41145i816CE8E72B20CF88/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Syed0000_0-1720659770483.png" alt="Syed0000_0-1720659770483.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 01:09:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Extracting-List-Elements-using-JOLT/m-p/390112#M247190</guid>
      <dc:creator>Syed0000</dc:creator>
      <dc:date>2024-07-11T01:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting List Elements using JOLT</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Extracting-List-Elements-using-JOLT/m-p/390138#M247205</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I think you are confusing the grouping function represented by #&amp;nbsp; with the reference function using &amp;amp;. what you need to do is actually reference the ARRAY_ONE index to group the fields properly.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
  {
    "operation": "shift",
    "spec": {
      "Data": {
        "ARRAY_ONE": {
          "*": {
            //&amp;amp;1 refernce the index above so you will have two elements
            "@(2,ID)": "[&amp;amp;1].ID",
            "@(2,DATE)": "[&amp;amp;1].DATE",
            "NAME": "[&amp;amp;1].NAME",
            "priceRuleAttributes": {
              "*": {
                "id": {
                  "PR_BRANCH_NAME": {
                     //&amp;amp;5 refernce ARRAY_ONE index at level 5 starting from this level (0)
                    "@(2,values)": "[&amp;amp;5].branchName"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you found this helpful please accept solution.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 09:32:56 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Extracting-List-Elements-using-JOLT/m-p/390138#M247205</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2024-07-11T09:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting List Elements using JOLT</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Extracting-List-Elements-using-JOLT/m-p/390157#M247217</link>
      <description>&lt;P&gt;Thanks its working fine.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 14:45:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Extracting-List-Elements-using-JOLT/m-p/390157#M247217</guid>
      <dc:creator>Syed0000</dc:creator>
      <dc:date>2024-07-11T14:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting List Elements using JOLT</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Extracting-List-Elements-using-JOLT/m-p/390158#M247218</link>
      <description>&lt;P&gt;can i get single value instead of array ?&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"branchName" : ["MEMBERS"] --&amp;gt; "branchName" : "MEMBERS"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[ {
  "ID" : "09878666",
  "DATE" : "2022-01-01",
  "NAME" : "test_1",
  "branchName" : "MEMBERS",
}, {
  "ID" : "09878666",
  "DATE" : "2022-01-01",
  "NAME" : "test_2",
  "branchName" : "NON MEMBERS"
} ]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 17:42:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Extracting-List-Elements-using-JOLT/m-p/390158#M247218</guid>
      <dc:creator>Syed0000</dc:creator>
      <dc:date>2024-07-11T17:42:39Z</dc:date>
    </item>
  </channel>
</rss>

