<?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: Converting MySQL row wise values to column values  having no group by value in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Converting-MySQL-row-wise-values-to-column-values-having-no/m-p/2228380#M19667</link>
    <description>&lt;P&gt;But the XML response is like:&lt;/P&gt;&lt;P&gt;&amp;lt;item&amp;gt;&lt;BR /&gt;&amp;lt;key xsi:type="xsd:string"&amp;gt;EmpId&amp;lt;/key&amp;gt;&lt;BR /&gt;&amp;lt;value xsi:type="xsd:string"&amp;gt;100&amp;lt;/value&amp;gt;&lt;BR /&gt;&amp;lt;/item&amp;gt;&lt;BR /&gt;&amp;lt;item&amp;gt;&lt;BR /&gt;&amp;lt;key xsi:type="xsd:string"&amp;gt;Name&amp;lt;/key&amp;gt;&lt;BR /&gt;&amp;lt;value xsi:type="xsd:string"&amp;gt;ABC&amp;lt;/value&amp;gt;&lt;BR /&gt;&amp;lt;/item&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So while retrieving this XML file, It shows&amp;nbsp;&lt;STRONG&gt;key&lt;/STRONG&gt; &amp;amp;&amp;nbsp;&lt;STRONG&gt;value &lt;/STRONG&gt;as input columns.Then how can we extract values in the&amp;nbsp;&lt;STRONG&gt;key&lt;/STRONG&gt; as separate columns using tExtractXMLField??&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jan 2019 06:37:19 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-01-30T06:37:19Z</dc:date>
    <item>
      <title>Converting MySQL row wise values to column values  having no group by value</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Converting-MySQL-row-wise-values-to-column-values-having-no/m-p/2228378#M19665</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I have one XML file.I have stored that xml file response to a table as,&lt;/P&gt; 
&lt;P&gt;&lt;BR /&gt;Id&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Key&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Value&lt;BR /&gt;------------------------------&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EmpId&amp;nbsp; &amp;nbsp; &amp;nbsp;100&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Name&amp;nbsp; &amp;nbsp; &amp;nbsp; ABC&lt;BR /&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Age&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;23&lt;BR /&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EmpId&amp;nbsp; &amp;nbsp; &amp;nbsp;105&lt;BR /&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Name&amp;nbsp; &amp;nbsp; &amp;nbsp; XYZ&lt;BR /&gt;6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Age&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;25&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I want these values in the format as given below,&lt;/P&gt; 
&lt;P&gt;&lt;BR /&gt;Id&amp;nbsp; &amp;nbsp; &amp;nbsp; EmpId&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Name&amp;nbsp; &amp;nbsp; &amp;nbsp; Age&lt;BR /&gt;----------------------------------------&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;100&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;23&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;105&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XYZ&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;25&lt;/P&gt; 
&lt;P&gt;&lt;BR /&gt;How can I convert it??&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks In Advance&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 05:20:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Converting-MySQL-row-wise-values-to-column-values-having-no/m-p/2228378#M19665</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-01-30T05:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Converting MySQL row wise values to column values  having no group by value</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Converting-MySQL-row-wise-values-to-column-values-having-no/m-p/2228379#M19666</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the most proper and easiest way - if you still have XML file (as followed from your&amp;nbsp;message) it is parse XML with tExtractXMLFields&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with MySQL it&amp;nbsp;is not so easy - first of all because select without ORDER BY no warrant for you order of rows&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you sure - all tags stored with strong as id column (first 3 row - first client, next 3 row - next and etc)&lt;/P&gt;
&lt;P&gt;personally I will add column&amp;nbsp;emp_id and populate it with this logic, it will be:&lt;/P&gt;
&lt;PRE&gt;Id          Key       Value        emp_id
----------------------------------------
1          EmpId     100           100
2          Name      ABC           100
3          Age         23          100
4          EmpId     105           105
5          Name      XYZ           105
6          Age         25          105&lt;/PRE&gt;
&lt;P&gt;after this you can easy use SELECT with GROUP BY for prepare target structure&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 06:10:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Converting-MySQL-row-wise-values-to-column-values-having-no/m-p/2228379#M19666</guid>
      <dc:creator>vapukov</dc:creator>
      <dc:date>2019-01-30T06:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: Converting MySQL row wise values to column values  having no group by value</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Converting-MySQL-row-wise-values-to-column-values-having-no/m-p/2228380#M19667</link>
      <description>&lt;P&gt;But the XML response is like:&lt;/P&gt;&lt;P&gt;&amp;lt;item&amp;gt;&lt;BR /&gt;&amp;lt;key xsi:type="xsd:string"&amp;gt;EmpId&amp;lt;/key&amp;gt;&lt;BR /&gt;&amp;lt;value xsi:type="xsd:string"&amp;gt;100&amp;lt;/value&amp;gt;&lt;BR /&gt;&amp;lt;/item&amp;gt;&lt;BR /&gt;&amp;lt;item&amp;gt;&lt;BR /&gt;&amp;lt;key xsi:type="xsd:string"&amp;gt;Name&amp;lt;/key&amp;gt;&lt;BR /&gt;&amp;lt;value xsi:type="xsd:string"&amp;gt;ABC&amp;lt;/value&amp;gt;&lt;BR /&gt;&amp;lt;/item&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So while retrieving this XML file, It shows&amp;nbsp;&lt;STRONG&gt;key&lt;/STRONG&gt; &amp;amp;&amp;nbsp;&lt;STRONG&gt;value &lt;/STRONG&gt;as input columns.Then how can we extract values in the&amp;nbsp;&lt;STRONG&gt;key&lt;/STRONG&gt; as separate columns using tExtractXMLField??&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 06:37:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Converting-MySQL-row-wise-values-to-column-values-having-no/m-p/2228380#M19667</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-01-30T06:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: Converting MySQL row wise values to column values  having no group by value</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Converting-MySQL-row-wise-values-to-column-values-having-no/m-p/2228381#M19668</link>
      <description>&lt;P&gt;I don't like work with partial information (because a lot of IF ...)&lt;/P&gt; 
&lt;P&gt;but as variant:&lt;/P&gt; 
&lt;P&gt;1.&lt;/P&gt; 
&lt;P&gt;XML must have a structure (or it is broken form):&lt;/P&gt; 
&lt;PRE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&amp;gt;
    &amp;lt;item&amp;gt;
        &amp;lt;key xsi:type="xsd:string"&amp;gt;EmpId&amp;lt;/key&amp;gt;
        &amp;lt;value xsi:type="xsd:string"&amp;gt;100&amp;lt;/value&amp;gt;
    &amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;
        &amp;lt;key xsi:type="xsd:string"&amp;gt;Name&amp;lt;/key&amp;gt;
        &amp;lt;value xsi:type="xsd:string"&amp;gt;ABC&amp;lt;/value&amp;gt;
    &amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;
        &amp;lt;key xsi:type="xsd:string"&amp;gt;Age&amp;lt;/key&amp;gt;
        &amp;lt;value xsi:type="xsd:string"&amp;gt;23&amp;lt;/value&amp;gt;
    &amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;
        &amp;lt;key xsi:type="xsd:string"&amp;gt;EmpId&amp;lt;/key&amp;gt;
        &amp;lt;value xsi:type="xsd:string"&amp;gt;105&amp;lt;/value&amp;gt;
    &amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;
        &amp;lt;key xsi:type="xsd:string"&amp;gt;Name&amp;lt;/key&amp;gt;
        &amp;lt;value xsi:type="xsd:string"&amp;gt;XYZ&amp;lt;/value&amp;gt;
    &amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;
        &amp;lt;key xsi:type="xsd:string"&amp;gt;Age&amp;lt;/key&amp;gt;
        &amp;lt;value xsi:type="xsd:string"&amp;gt;25&amp;lt;/value&amp;gt;
    &amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;
        &amp;lt;key xsi:type="xsd:string"&amp;gt;EmpId&amp;lt;/key&amp;gt;
        &amp;lt;value xsi:type="xsd:string"&amp;gt;110&amp;lt;/value&amp;gt;
    &amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;
        &amp;lt;key xsi:type="xsd:string"&amp;gt;Name&amp;lt;/key&amp;gt;
        &amp;lt;value xsi:type="xsd:string"&amp;gt;WHY&amp;lt;/value&amp;gt;
    &amp;lt;/item&amp;gt;
    &amp;lt;item&amp;gt;
        &amp;lt;key xsi:type="xsd:string"&amp;gt;Age&amp;lt;/key&amp;gt;
        &amp;lt;value xsi:type="xsd:string"&amp;gt;30&amp;lt;/value&amp;gt;
    &amp;lt;/item&amp;gt;
&amp;lt;/root&amp;gt;&lt;/PRE&gt; 
&lt;P&gt;this is easy to fix even if not, just add at the begin and end:&lt;/P&gt; 
&lt;PRE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&amp;gt;


ALL ITEMS HERE

&amp;lt;/root&amp;gt;&lt;/PRE&gt; 
&lt;P&gt;2. we are sure, each item contain same number of tag (allways)!!! this is important&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;in this case it is easy:&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2019-01-30 at 11.45.38 PM.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M2K1.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/131874i3AEB9D261FFD2F5D/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M2K1.png" alt="0683p000009M2K1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;we use separate flows for EmpId, name, Age (with XPath filter)&lt;/P&gt; 
&lt;P&gt;and then add in tMap row number (just a sequence, but separate sequence for each filtered row)&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;and finally join flows by row number, with result&amp;nbsp;as:&lt;/P&gt; 
&lt;PRE&gt;.-----+----+---.
|  tLogRow_1   |
|=----+----+--=|
|EmpId|Name|Age|
|=----+----+--=|
|100  |ABC |23 |
|105  |XYZ |25 |
|110  |WHY |30 |
'-----+----+---'&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 10:48:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Converting-MySQL-row-wise-values-to-column-values-having-no/m-p/2228381#M19668</guid>
      <dc:creator>vapukov</dc:creator>
      <dc:date>2019-01-30T10:48:39Z</dc:date>
    </item>
  </channel>
</rss>

