<?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>topic Re: Qliksense json code parser in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Qliksense-json-code-parser/m-p/2498446#M102881</link>
    <description>&lt;P&gt;To work with JSON data like this in Qlik Sense, one approach is to leverage the &lt;STRONG&gt;JSON functions&lt;/STRONG&gt; (&lt;CODE&gt;JsonGet&lt;/CODE&gt;, &lt;CODE&gt;IsJson&lt;/CODE&gt;, etc.) to extract the data into a structured format. Once the data is in a standard Qlik table, you can perform your calculations and aggregations more easily.&lt;/P&gt;
&lt;P&gt;Here’s an example script that extracts the &lt;CODE&gt;prodCount&lt;/CODE&gt; values from the JSON field into a Qlik data table:&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;PRE class="!overflow-visible"&gt;&lt;CODE class="!whitespace-pre hljs language-qlik"&gt;SET json =
[
  {
    "SS": "SS096084",
    "BarkodeID": "c264fb35-1775-4b9e-8faf-1a2d267ef64e",
    "DilmeTip": "Tek",
    "Miktar": 8300,
    "barcodes": [
      {
        "MainItemId": "IZO1000003",
        "LotNr": "IV44688909",
        "Type": "",
        "width": 1200,
        "prodCount": 1,
        "Miktar": 8300,
        "Dara": 1.92,
        "special1": "1200 MM YANMAZ ALU FOLYO",
        "special2": "",
        "special3": "Eylül 2024",
        "special4": "",
        "special5": "",
        "special6": "00190144",
        "special8": 1000,
        "special9": 1200
      }
    ]
  },
  ... continued
];

jsonExtract:
Load
	jsonBarcodes,
    JsonGet(jsonBarcodes, '/prodCount') AS prodCount;
LOAD
	jsonItems,
    JsonGet(jsonItems, '/barcodes/'&amp;amp;(IterNo()-1)) AS jsonBarcodes
WHILE IsJson(JsonGet(jsonItems, '/barcodes/' &amp;amp; (IterNo()-1)));
LOAD
    JsonGet(json, '/'&amp;amp;(IterNo()-1)) AS jsonItems
WHILE IsJson(JsonGet(json, '/' &amp;amp; (IterNo()-1)));

LOAD 
	'$(json)' as json 
AutoGenerate 1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;H3&gt;Explanation:&lt;/H3&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Iteratively Parse the JSON&lt;/STRONG&gt;:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The script uses &lt;CODE&gt;JsonGet()&lt;/CODE&gt; and &lt;CODE&gt;IterNo()&lt;/CODE&gt; to loop through each object in the JSON array and extract the &lt;CODE&gt;barcodes&lt;/CODE&gt; array for each entry.&lt;/LI&gt;
&lt;LI&gt;It then loops through each &lt;CODE&gt;barcodes&lt;/CODE&gt; array to extract &lt;CODE&gt;prodCount&lt;/CODE&gt;.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Output&lt;/STRONG&gt;:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The &lt;CODE&gt;jsonExtract&lt;/CODE&gt; table will contain the &lt;CODE&gt;prodCount&lt;/CODE&gt; values extracted from the JSON.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Perform Aggregations&lt;/STRONG&gt;:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Once the data is in table format, you can aggregate &lt;CODE&gt;prodCount&lt;/CODE&gt; values or perform any other operations using Qlik expressions.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Wed, 18 Dec 2024 03:44:08 GMT</pubDate>
    <dc:creator>nhenckel</dc:creator>
    <dc:date>2024-12-18T03:44:08Z</dc:date>
    <item>
      <title>Qliksense json code parser</title>
      <link>https://community.qlik.com/t5/App-Development/Qliksense-json-code-parser/m-p/2477492#M100370</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a table and one of the fields in this table comes as json. Here I want to make this calculation in the field that comes as json. I want to show the total of the product counts between two barcodes in the new field. I want the calculation to end when I see the second barcodes field.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tables:&lt;/P&gt;
&lt;P&gt;1-&lt;/P&gt;
&lt;P&gt;[{"SS":"SS096084","BarkodeID":"c264fb35-1775-4b9e-8faf-1a2d267ef64e","DilmeTip":"Tek","Miktar":8300,"barcodes":[{"MainItemId":"IZO1000003","LotNr":"IV44688909","Type":"","width":1200,"prodCount":1,"Miktar":8300,"Dara":1.92,"special1":"1200 MM YANMAZ ALU FOLYO","special2":"","special3":"Eylül 2024","special4":"","special5":"","special6":"00190144","special8":1000,"special9":1200}]}]&lt;/P&gt;
&lt;P&gt;2-&amp;nbsp;[{"SS":"SS101505","BarkodeID":"c264fb35-1775-4b9e-8faf-1a2d267ef64e","DilmeTip":"CokluKombine","Miktar":4201,"barcodes":[{"MainItemId":"DGY1000087-03","LotNr":"IV47822711","Type":"balkan","width":368,"prodCount":2,"Miktar":2800,"Dara":0.77,"special1":"OPP PATOS ROLLS SP.PLUS(BALKAN)(2 BANT)","special2":"21658-B","special3":"18753","special4":"","special5":"","special6":"00197477","special8":1000,"special9":368},{"MainItemId":"DGY1000071-03","LotNr":"IV47822705","Type":"dünya","width":368,"prodCount":1,"Miktar":1400,"Dara":0.77,"special1":"OPP PATOS ROLLS SP.PLUS(DÜNYA)(TEK BANT)","special2":"21658-B","special3":"18753","special4":"","special5":"","special6":"00197477","special8":1000,"special9":368}]},{"SS":"SS101506","BarkodeID":"c264fb35-1775-4b9e-8faf-1a2d267ef64e","DilmeTip":"CokluKombine","Miktar":4201,"barcodes":[{"MainItemId":"DGY1000087-03","LotNr":"IV47822717","Type":"balkan","width":368,"prodCount":2,"Miktar":2800,"Dara":0.77,"special1":"OPP PATOS ROLLS SP.PLUS(BALKAN)(2 BANT)","special2":"21658-B","special3":"18754","special4":"","special5":"","special6":"00197477","special8":1000,"special9":368},{"MainItemId":"DGY1000071-03","LotNr":"IV47822713","Type":"dünya","width":368,"prodCount":1,"Miktar":1400,"Dara":0.77,"special1":"OPP PATOS ROLLS SP.PLUS(DÜNYA)(TEK BANT)","special2":"21658-B","special3":"18754","special4":"","special5":"","special6":"00197477","special8":1000,"special9":368}]},{"SS":"SS102096","BarkodeID":"c264fb35-1775-4b9e-8faf-1a2d267ef64e","DilmeTip":"CokluKombine","Miktar":6300,"barcodes":[{"MainItemId":"DGY1000087-03","LotNr":"IV48204473","Type":"balkan","width":368,"prodCount":2,"Miktar":4200,"Dara":0.77,"special1":"OPP PATOS ROLLS SP.PLUS(BALKAN)(2 BANT)","special2":"21658-D","special3":"18753","special4":"","special5":"","special6":"00197477","special8":1000,"special9":368},{"MainItemId":"DGY1000071-03","LotNr":"IV48204474","Type":"dünya","width":368,"prodCount":1,"Miktar":2100,"Dara":0.77,"special1":"OPP PATOS ROLLS SP.PLUS(DÜNYA)(TEK BANT)","special2":"21658-D","special3":"18753","special4":"","special5":"","special6":"00197477","special8":1000,"special9":368}]},{"SS":"SS102097","BarkodeID":"c264fb35-1775-4b9e-8faf-1a2d267ef64e","DilmeTip":"CokluKombine","Miktar":6300,"barcodes":[{"MainItemId":"DGY1000087-03","LotNr":"IV48204484","Type":"balkan","width":368,"prodCount":2,"Miktar":4200,"Dara":0.77,"special1":"OPP PATOS ROLLS SP.PLUS(BALKAN)(2 BANT)","special2":"21658-D","special3":"18754","special4":"","special5":"","special6":"00197477","special8":1000,"special9":368},{"MainItemId":"DGY1000071-03","LotNr":"IV48204536","Type":"dünya","width":368,"prodCount":1,"Miktar":2100,"Dara":0.77,"special1":"OPP PATOS ROLLS SP.PLUS(DÜNYA)(TEK BANT)","special2":"21658-D","special3":"18754","special4":"","special5":"","special6":"00197477","special8":1000,"special9":368}]}]&lt;/P&gt;
&lt;P&gt;3-[{"SS":"SS101511","BarkodeID":"c264fb35-1775-4b9e-8faf-1a2d267ef64e","DilmeTip":"Tek","Miktar":2110,"barcodes":[{"MainItemId":"DGY1000235-01","LotNr":"IV47822870","Type":"","width":410,"prodCount":2,"Miktar":2110,"Dara":0.86,"special1":"OPP AMİGO TACO BAH. SÜPER(kg)(FLEKSO)","special2":"21634","special3":"18753","special4":"","special5":"291.45 mm","special6":"00197520","special8":1000,"special9":410}]}]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to Result :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;ProdCount&lt;/P&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;P&gt;3&lt;/P&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Thu, 22 Aug 2024 10:42:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qliksense-json-code-parser/m-p/2477492#M100370</guid>
      <dc:creator>krmvacar</dc:creator>
      <dc:date>2024-08-22T10:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: Qliksense json code parser</title>
      <link>https://community.qlik.com/t5/App-Development/Qliksense-json-code-parser/m-p/2498446#M102881</link>
      <description>&lt;P&gt;To work with JSON data like this in Qlik Sense, one approach is to leverage the &lt;STRONG&gt;JSON functions&lt;/STRONG&gt; (&lt;CODE&gt;JsonGet&lt;/CODE&gt;, &lt;CODE&gt;IsJson&lt;/CODE&gt;, etc.) to extract the data into a structured format. Once the data is in a standard Qlik table, you can perform your calculations and aggregations more easily.&lt;/P&gt;
&lt;P&gt;Here’s an example script that extracts the &lt;CODE&gt;prodCount&lt;/CODE&gt; values from the JSON field into a Qlik data table:&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;PRE class="!overflow-visible"&gt;&lt;CODE class="!whitespace-pre hljs language-qlik"&gt;SET json =
[
  {
    "SS": "SS096084",
    "BarkodeID": "c264fb35-1775-4b9e-8faf-1a2d267ef64e",
    "DilmeTip": "Tek",
    "Miktar": 8300,
    "barcodes": [
      {
        "MainItemId": "IZO1000003",
        "LotNr": "IV44688909",
        "Type": "",
        "width": 1200,
        "prodCount": 1,
        "Miktar": 8300,
        "Dara": 1.92,
        "special1": "1200 MM YANMAZ ALU FOLYO",
        "special2": "",
        "special3": "Eylül 2024",
        "special4": "",
        "special5": "",
        "special6": "00190144",
        "special8": 1000,
        "special9": 1200
      }
    ]
  },
  ... continued
];

jsonExtract:
Load
	jsonBarcodes,
    JsonGet(jsonBarcodes, '/prodCount') AS prodCount;
LOAD
	jsonItems,
    JsonGet(jsonItems, '/barcodes/'&amp;amp;(IterNo()-1)) AS jsonBarcodes
WHILE IsJson(JsonGet(jsonItems, '/barcodes/' &amp;amp; (IterNo()-1)));
LOAD
    JsonGet(json, '/'&amp;amp;(IterNo()-1)) AS jsonItems
WHILE IsJson(JsonGet(json, '/' &amp;amp; (IterNo()-1)));

LOAD 
	'$(json)' as json 
AutoGenerate 1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;H3&gt;Explanation:&lt;/H3&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Iteratively Parse the JSON&lt;/STRONG&gt;:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The script uses &lt;CODE&gt;JsonGet()&lt;/CODE&gt; and &lt;CODE&gt;IterNo()&lt;/CODE&gt; to loop through each object in the JSON array and extract the &lt;CODE&gt;barcodes&lt;/CODE&gt; array for each entry.&lt;/LI&gt;
&lt;LI&gt;It then loops through each &lt;CODE&gt;barcodes&lt;/CODE&gt; array to extract &lt;CODE&gt;prodCount&lt;/CODE&gt;.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Output&lt;/STRONG&gt;:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The &lt;CODE&gt;jsonExtract&lt;/CODE&gt; table will contain the &lt;CODE&gt;prodCount&lt;/CODE&gt; values extracted from the JSON.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Perform Aggregations&lt;/STRONG&gt;:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Once the data is in table format, you can aggregate &lt;CODE&gt;prodCount&lt;/CODE&gt; values or perform any other operations using Qlik expressions.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Wed, 18 Dec 2024 03:44:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qliksense-json-code-parser/m-p/2498446#M102881</guid>
      <dc:creator>nhenckel</dc:creator>
      <dc:date>2024-12-18T03:44:08Z</dc:date>
    </item>
  </channel>
</rss>

