<?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: How to transpose a table in script? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-transpose-a-table-in-script/m-p/1722281#M54958</link>
    <description>&lt;P&gt;One Solution :&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Input:

load ID,if(previous(ID)=ID,'User_'&amp;amp;(peek('ValuTmp')+1),'User_1') as UserID,if(previous(ID)=ID,peek('ValuTmp')+1,1) as ValuTmp, User;
load * inline [
ID,User
1,AB
1,BC
2,CD
2,EF
2,GH
3,IJ

];

drop fields ValuTmp;



CombinedGenericTable:

Load distinct ID resident Input;

DATA:
Generic load * resident Input;

drop table Input;
   
   

FOR i = NoOfTables()-1 to 0 STEP -1

  LET vTable=TableName($(i));

  IF WildMatch('$(vTable)', 'DATA.*') THEN 

  LEFT JOIN ([CombinedGenericTable]) LOAD distinct * RESIDENT [$(vTable)];

  DROP TABLE [$(vTable)];

  ENDIF 

NEXT i&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 605px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/36285i5B7428EB264D53EF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jun 2020 16:31:22 GMT</pubDate>
    <dc:creator>Taoufiq_Zarra</dc:creator>
    <dc:date>2020-06-25T16:31:22Z</dc:date>
    <item>
      <title>How to transpose a table in script?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-transpose-a-table-in-script/m-p/1722257#M54955</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I am trying to tranpose a table but without sucess.&lt;/P&gt;&lt;P&gt;There, my file where i have an ID and few user per ID&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="menphis12_0-1593100348655.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/36278i37F72538C76D6763/image-size/medium?v=v2&amp;amp;px=400" role="button" title="menphis12_0-1593100348655.png" alt="menphis12_0-1593100348655.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I need to tranpose these table and get that :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="menphis12_2-1593100424387.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/36280i458B0318CCD6A562/image-size/medium?v=v2&amp;amp;px=400" role="button" title="menphis12_2-1593100424387.png" alt="menphis12_2-1593100424387.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If i can do it automatically, it will be better.&lt;BR /&gt;I need to calculate a max of user per ID (of example 3 in our case ), and generate three Colomn.&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Avy&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 18:26:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-transpose-a-table-in-script/m-p/1722257#M54955</guid>
      <dc:creator>menphis12</dc:creator>
      <dc:date>2024-11-16T18:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose a table in script?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-transpose-a-table-in-script/m-p/1722281#M54958</link>
      <description>&lt;P&gt;One Solution :&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Input:

load ID,if(previous(ID)=ID,'User_'&amp;amp;(peek('ValuTmp')+1),'User_1') as UserID,if(previous(ID)=ID,peek('ValuTmp')+1,1) as ValuTmp, User;
load * inline [
ID,User
1,AB
1,BC
2,CD
2,EF
2,GH
3,IJ

];

drop fields ValuTmp;



CombinedGenericTable:

Load distinct ID resident Input;

DATA:
Generic load * resident Input;

drop table Input;
   
   

FOR i = NoOfTables()-1 to 0 STEP -1

  LET vTable=TableName($(i));

  IF WildMatch('$(vTable)', 'DATA.*') THEN 

  LEFT JOIN ([CombinedGenericTable]) LOAD distinct * RESIDENT [$(vTable)];

  DROP TABLE [$(vTable)];

  ENDIF 

NEXT i&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 605px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/36285i5B7428EB264D53EF/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2020 16:31:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-transpose-a-table-in-script/m-p/1722281#M54958</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-06-25T16:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose a table in script?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-transpose-a-table-in-script/m-p/1722411#M54970</link>
      <description>&lt;P&gt;One solution is.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;tab1:
Generic
LOAD ID, 'User_'&amp;amp;AutoNumber(RowNo(),ID), User;
LOAD * INLINE [
ID,User
1,AB
1,BC
2,CD
2,EF
2,GH
3,IJ
];&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 26 Jun 2020 02:54:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-transpose-a-table-in-script/m-p/1722411#M54970</guid>
      <dc:creator>Saravanan_Desingh</dc:creator>
      <dc:date>2020-06-26T02:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to transpose a table in script?</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-transpose-a-table-in-script/m-p/1722413#M54971</link>
      <description>&lt;P&gt;Output.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="commQV84.PNG" style="width: 148px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/36311iC7F694E544AEE5E4/image-size/large?v=v2&amp;amp;px=999" role="button" title="commQV84.PNG" alt="commQV84.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2020 02:55:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-transpose-a-table-in-script/m-p/1722413#M54971</guid>
      <dc:creator>Saravanan_Desingh</dc:creator>
      <dc:date>2020-06-26T02:55:29Z</dc:date>
    </item>
  </channel>
</rss>

