<?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: DataMapper - Transform JSON array to XML in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203355#M4710</link>
    <description>Thank's for reply, I used a RegEx for determine category to use. 
&lt;BR /&gt;category_1: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MByu.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/146809iF46433E8A46319E3/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MByu.png" alt="0683p000009MByu.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;category_2: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MC1h.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/151153i6CAE3499A4D0CAD1/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MC1h.png" alt="0683p000009MC1h.png" /&gt;&lt;/span&gt;category_3: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MC0p.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/153436iC9D46ABAFA210D4D/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MC0p.png" alt="0683p000009MC0p.png" /&gt;&lt;/span&gt;However, when I click on "Test Run", I have the bug: 
&lt;BR /&gt;&amp;nbsp;" 
&lt;B&gt;Exception during test run:&lt;/B&gt; 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;B&gt;Thread Expr in$/Root/hits/hits/_source/category enclosing node: out$/Root/RequiredRecord/souscategorie_value != out$/Root/RequiredRecord/souscategorie2_value&lt;/B&gt;" 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBjy.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/132301i0E7F59E6AF1D8382/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBjy.png" alt="0683p000009MBjy.png" /&gt;&lt;/span&gt;I specify that I use this function in several Maps.&amp;nbsp;On the other Map (1 only), everything is ok. 
&lt;BR /&gt;There is a problem with json structure?</description>
    <pubDate>Mon, 14 Nov 2016 12:21:09 GMT</pubDate>
    <dc:creator>param75</dc:creator>
    <dc:date>2016-11-14T12:21:09Z</dc:date>
    <item>
      <title>DataMapper - Transform JSON array to XML</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203349#M4704</link>
      <description>Hi, 
&lt;BR /&gt;I use a mapping (component tHMap) to transform data from a JSON to XML. 
&lt;BR /&gt;However, I do not know how to retrieve the first, second (or more) values of a JSON array. 
&lt;BR /&gt;My first step would be to just get the first item and place it in the first tag category_1. 
&lt;BR /&gt;Ditto for the next elements. 
&lt;BR /&gt;"category" field into my JSON file: 
&lt;BR /&gt; 
&lt;PRE&gt;"category":&lt;/PRE&gt; 
&lt;BR /&gt; 
&lt;BR /&gt;Here is the structure that I want to generate: 
&lt;BR /&gt; 
&lt;PRE&gt;&amp;lt;categories&amp;gt;&lt;BR /&gt;	&amp;lt;category_1&amp;gt;test&amp;lt;/category_1&amp;gt;&lt;BR /&gt;	&amp;lt;category_1&amp;gt;test_talend_2&amp;lt;/category_1&amp;gt;&lt;BR /&gt;	&amp;lt;category_1&amp;gt;test_talend&amp;lt;/category_1&amp;gt;&lt;BR /&gt;&amp;lt;/categories&amp;gt;&lt;BR /&gt;&lt;/PRE&gt; 
&lt;BR /&gt; 
&lt;BR /&gt;Here is my mapping (Map): 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MC1S.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/155850i8675BE8CA0523D39/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MC1S.png" alt="0683p000009MC1S.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;I think we should to use a Loop function but i dont know how to use it: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBwY.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/132011i533BB2683E8ADE08/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBwY.png" alt="0683p000009MBwY.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;Properties of "category" in JSON structure: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MC1X.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/142573iF8C6B9D00FBA7AA1/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MC1X.png" alt="0683p000009MC1X.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;My second step is to sort the values by string length. Exemple: 
&lt;BR /&gt; 
&lt;PRE&gt;&amp;lt;categories&amp;gt;&lt;BR /&gt;	&amp;lt;category_1&amp;gt;test&amp;lt;/category_1&amp;gt;&lt;BR /&gt;	&amp;lt;category_1&amp;gt;test_talend&amp;lt;/category_1&amp;gt;&lt;BR /&gt;	&amp;lt;category_1&amp;gt;test_talend_2&amp;lt;/category_1&amp;gt;&lt;BR /&gt;&amp;lt;/categories&amp;gt;&lt;/PRE&gt; 
&lt;BR /&gt;Is there a function for this in DataMapper? 
&lt;BR /&gt;Thks all.</description>
      <pubDate>Tue, 25 Oct 2016 08:50:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203349#M4704</guid>
      <dc:creator>param75</dc:creator>
      <dc:date>2016-10-25T08:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: DataMapper - Transform JSON array to XML</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203350#M4705</link>
      <description>Hello,&lt;BR /&gt;We have re-directed your issue to TDM expert and then come back to you as soon as we can.&lt;BR /&gt;Best regards&lt;BR /&gt;Sabrina</description>
      <pubDate>Fri, 04 Nov 2016 02:20:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203350#M4705</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-04T02:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: DataMapper - Transform JSON array to XML</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203351#M4706</link>
      <description>Hello&amp;nbsp;PM_param, what's your expected output? 
&lt;BR /&gt; 
&lt;BR /&gt;a loop of category_1? 
&lt;BR /&gt; 
&lt;PRE&gt;&amp;lt;categories&amp;gt;&lt;BR /&gt; &amp;lt;category_1&amp;gt;test&amp;lt;/category_1&amp;gt;&lt;BR /&gt; &amp;lt;category_1&amp;gt;test_talend_2&amp;lt;/category_1&amp;gt;&lt;BR /&gt; &amp;lt;category_1&amp;gt;test_talend&amp;lt;/category_1&amp;gt;&lt;BR /&gt;&amp;lt;/categories&amp;gt;&lt;/PRE&gt; 
&lt;BR /&gt;category_1 and category_2 and&amp;nbsp;category_3? 
&lt;BR /&gt; 
&lt;PRE&gt;&amp;lt;categories&amp;gt;&lt;BR /&gt; &amp;lt;category_1&amp;gt;test&amp;lt;/category_1&amp;gt;&lt;BR /&gt; &amp;lt;category_2&amp;gt;test_talend_2&amp;lt;/category_2&amp;gt;&lt;BR /&gt; &amp;lt;category_3&amp;gt;test_talend&amp;lt;/category_3&amp;gt;&lt;BR /&gt;&amp;lt;/categories&amp;gt;&lt;/PRE&gt; 
&lt;BR /&gt;a sorted loop of category_1? 
&lt;BR /&gt; 
&lt;PRE&gt;&amp;lt;categories&amp;gt;&lt;BR /&gt; &amp;lt;category_1&amp;gt;test&amp;lt;/category_1&amp;gt;&lt;BR /&gt; &amp;lt;category_1&amp;gt;test_talend&amp;lt;/category_1&amp;gt;&lt;BR /&gt; &amp;lt;category_1&amp;gt;test_talend_2&amp;lt;/category_1&amp;gt;&lt;BR /&gt;&amp;lt;/categories&amp;gt;&lt;/PRE&gt; 
&lt;BR /&gt;Something else? 
&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Nov 2016 10:17:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203351#M4706</guid>
      <dc:creator>Haitao</dc:creator>
      <dc:date>2016-11-04T10:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: DataMapper - Transform JSON array to XML</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203352#M4707</link>
      <description>To get the 2nd type of output, please use the AgConcat and SingleIndex functions as below 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MC1c.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/141323iE21B92D40B859D5D/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MC1c.png" alt="0683p000009MC1c.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Fri, 04 Nov 2016 14:53:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203352#M4707</guid>
      <dc:creator>Haitao</dc:creator>
      <dc:date>2016-11-04T14:53:15Z</dc:date>
    </item>
    <item>
      <title>Re: DataMapper - Transform JSON array to XML</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203353#M4708</link>
      <description>Hi hnie, 
&lt;BR /&gt;Thank's for your answer,&amp;nbsp;the expected ouput is the lowest value in category 1, category 2 in the second and last (the longuest value) in category 3. 
&lt;BR /&gt;Today i resolve the first problem which was the XML structure.&amp;nbsp;Now the field is set as below: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MByF.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/133339iC880908F02F9B0B7/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MByF.png" alt="0683p000009MByF.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;In my Map,&amp;nbsp;I loop on "category" and I recovers only one that interested me as below: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MByt.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/151693iA640D75BC7B33168/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MByt.png" alt="0683p000009MByt.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;However I think there is a simpler method to get the right values, no? There is a function for compare values length? 
&lt;BR /&gt;Thank's for you help.</description>
      <pubDate>Fri, 04 Nov 2016 15:35:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203353#M4708</guid>
      <dc:creator>param75</dc:creator>
      <dc:date>2016-11-04T15:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: DataMapper - Transform JSON array to XML</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203354#M4709</link>
      <description>Functions/String/StringLength and Functions/Comparison and Logical/* will allow your to compare values length.</description>
      <pubDate>Wed, 09 Nov 2016 22:54:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203354#M4709</guid>
      <dc:creator>Haitao</dc:creator>
      <dc:date>2016-11-09T22:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: DataMapper - Transform JSON array to XML</title>
      <link>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203355#M4710</link>
      <description>Thank's for reply, I used a RegEx for determine category to use. 
&lt;BR /&gt;category_1: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MByu.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/146809iF46433E8A46319E3/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MByu.png" alt="0683p000009MByu.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;category_2: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MC1h.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/151153i6CAE3499A4D0CAD1/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MC1h.png" alt="0683p000009MC1h.png" /&gt;&lt;/span&gt;category_3: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MC0p.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/153436iC9D46ABAFA210D4D/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MC0p.png" alt="0683p000009MC0p.png" /&gt;&lt;/span&gt;However, when I click on "Test Run", I have the bug: 
&lt;BR /&gt;&amp;nbsp;" 
&lt;B&gt;Exception during test run:&lt;/B&gt; 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;B&gt;Thread Expr in$/Root/hits/hits/_source/category enclosing node: out$/Root/RequiredRecord/souscategorie_value != out$/Root/RequiredRecord/souscategorie2_value&lt;/B&gt;" 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBjy.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/132301i0E7F59E6AF1D8382/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBjy.png" alt="0683p000009MBjy.png" /&gt;&lt;/span&gt;I specify that I use this function in several Maps.&amp;nbsp;On the other Map (1 only), everything is ok. 
&lt;BR /&gt;There is a problem with json structure?</description>
      <pubDate>Mon, 14 Nov 2016 12:21:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/DataMapper-Transform-JSON-array-to-XML/m-p/2203355#M4710</guid>
      <dc:creator>param75</dc:creator>
      <dc:date>2016-11-14T12:21:09Z</dc:date>
    </item>
  </channel>
</rss>

