<?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: Transpose a table in Load Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Transpose-a-table-in-Load-Script/m-p/1730282#M592654</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;thank you very much for your help! That is what I needed!&lt;/P&gt;&lt;P&gt;Have a nice day!&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jul 2020 12:54:19 GMT</pubDate>
    <dc:creator>limu</dc:creator>
    <dc:date>2020-07-23T12:54:19Z</dc:date>
    <item>
      <title>Transpose a table in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Transpose-a-table-in-Load-Script/m-p/1730260#M592651</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table that has the following structure:&lt;/P&gt;&lt;TABLE border="1" width="97.92682926829269%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="25px"&gt;RowNo&lt;/TD&gt;&lt;TD height="25px"&gt;RowValue&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;1&lt;/TD&gt;&lt;TD height="25px"&gt;ValueA&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;1&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;ValueB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;2&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;ValueC&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;2&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;ValueD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;3&lt;/TD&gt;&lt;TD height="25px"&gt;ValueE&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;3&lt;/TD&gt;&lt;TD height="25px"&gt;ValueF&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;...&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;...&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to transform it the above table into the following table:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;Column1&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;Column2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;ValueA&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;ValueB&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;ValueC&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;ValueD&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;ValueE&amp;nbsp;&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;ValueF&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%" height="25px"&gt;...&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;...&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Can someone provide me some tips/examples on how one could make such a transformtion?&lt;/P&gt;&lt;P&gt;Currently, I'm fetching only the data that have the same value on RowNo (i.e. I'm fetching each row separately) and then in a For loop I'm concatinating all those values into one string, separated by comma. But this is very slow, and it takes hours to complete the transformations on the data set that I have.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 18:19:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Transpose-a-table-in-Load-Script/m-p/1730260#M592651</guid>
      <dc:creator>limu</dc:creator>
      <dc:date>2024-11-16T18:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose a table in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Transpose-a-table-in-Load-Script/m-p/1730279#M592652</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;the way will be to use generic load for this&amp;nbsp;&lt;/P&gt;&lt;P&gt;the script below will give you the result you are after&amp;nbsp;&lt;/P&gt;&lt;P&gt;it follows this steps :&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. add a column to the data with values column1,column2, etc. dynamically&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. use generic load which result in number of table according to the distinct values in the column we crated in step 1;&lt;/P&gt;&lt;P&gt;3. unifying the tables from step 2 to one table according to the RowNo key&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;DataTemp:
load * inline [
RowNo,	RowValue,
1,	ValueA
1,	ValueB
2	,ValueC
2,	ValueD
3	,ValueE
3,	ValueF];


Data:
load *,
     if(Previous(RowNo)=RowNo, rangesum(peek('counter'),1),1) as counter
resident DataTemp
order by RowNo;

drop Table DataTemp;


Data2:
load RowNo,
     'ColumnName' &amp;amp; counter as colName,
     RowValue
Resident Data;

drop Table Data;

Data:
Generic Load *
resident Data2;

drop table Data2;

/////////////////////////////
let vTables= NoofTables(); 
let vDataTableName = TableName(0);
RENAME Table $(vDataTableName) to Data;

for i =1 to NoofTables()-1
Tables:
 load TableName($(i)) as TableName ,$(i) as RN AutoGenerate 1;
NEXT

for i=1 to NoofTables()-1

 let vTableName =  FieldValue('TableName', $(i));
if len('$(vTableName)')&amp;gt;1 then
join (Data)
load * resident  $(vTableName) ;
drop table $(vTableName);
end if
next

drop Table Tables;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 12:47:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Transpose-a-table-in-Load-Script/m-p/1730279#M592652</guid>
      <dc:creator>lironbaram</dc:creator>
      <dc:date>2020-07-23T12:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: Transpose a table in Load Script</title>
      <link>https://community.qlik.com/t5/QlikView/Transpose-a-table-in-Load-Script/m-p/1730282#M592654</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;thank you very much for your help! That is what I needed!&lt;/P&gt;&lt;P&gt;Have a nice day!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 12:54:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Transpose-a-table-in-Load-Script/m-p/1730282#M592654</guid>
      <dc:creator>limu</dc:creator>
      <dc:date>2020-07-23T12:54:19Z</dc:date>
    </item>
  </channel>
</rss>

