<?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: Export to TXT/CSV with customized header in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Export-to-TXT-CSV-with-customized-header/m-p/1514829#M36698</link>
    <description>&lt;P&gt;If you&amp;nbsp;just use a little number of columns this would be a perfect solution:&lt;/P&gt;&lt;PRE&gt;Table1:
LOAD Customer &amp;amp; '|' &amp;amp; Sales as Reg INLINE [Customer, Sales
A,100
B,200
C,300
D,400
E,500
];

Header: Load 'Total rows: ' &amp;amp; Count(Reg) as numReg Resident Table1; 

LET vLabelColumn1 = peek('numReg',0,'Header');

TableToExport: LOAD PurgeChar(Reg,'"')	as '$(vLabelColumn1)' RESIDENT Table1;

DROP TABLE Table1, Header;

Store TableToExport into [Table1.txt](txt);&lt;/PRE&gt;&lt;P&gt;The result will be:&lt;/P&gt;&lt;PRE&gt;Total rows: 5
A|100
B|200
C|300
D|400
E|500&lt;/PRE&gt;</description>
    <pubDate>Fri, 30 Nov 2018 12:41:45 GMT</pubDate>
    <dc:creator>albert_guito</dc:creator>
    <dc:date>2018-11-30T12:41:45Z</dc:date>
    <item>
      <title>Export to TXT/CSV with customized header</title>
      <link>https://community.qlik.com/t5/App-Development/Export-to-TXT-CSV-with-customized-header/m-p/1514745#M36691</link>
      <description>&lt;P&gt;Hi scripting experts, I have below the table, need to export to csv/txt with a specific header. Any thoughts?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Input:&lt;/P&gt;
&lt;P&gt;Customer, Sales&lt;/P&gt;
&lt;P&gt;A,100&lt;/P&gt;
&lt;P&gt;B,200&lt;/P&gt;
&lt;P&gt;C,300&lt;/P&gt;
&lt;P&gt;D,400&lt;/P&gt;
&lt;P&gt;E,500&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Required output in txt/csv:&lt;/P&gt;
&lt;PRE&gt;Total rows: 5
A,100
B,200
C,300
D,400
E,500

&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;
&lt;P&gt;Not able to upload a qvf, so I attached the codes:&lt;/P&gt;
&lt;PRE&gt;Table1:

LOAD * INLINE [
Customer, Sales
A,100
B,200
C,300
D,400
E,500
];

Store Table1 into [lib://Data/Table1.txt](txt, delimiter is '|');&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 07:09:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Export-to-TXT-CSV-with-customized-header/m-p/1514745#M36691</guid>
      <dc:creator>qhe</dc:creator>
      <dc:date>2024-11-16T07:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Export to TXT/CSV with customized header</title>
      <link>https://community.qlik.com/t5/App-Development/Export-to-TXT-CSV-with-customized-header/m-p/1514808#M36696</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can try with this code:&lt;/P&gt;&lt;PRE&gt;Table1:
LOAD * INLINE [Customer, Sales
A,100
B,200
C,300
D,400
E,500
];

Header: Load 'Total rows: ' &amp;amp; Count(Customer) as numReg Resident Table1; 

let vLabelColumn1 = peek('numReg',0,'Header');
let vLabelColumn2 = ' ';

TableToExport:
LOAD 
	Customer as '$(vLabelColumn1)',
	Sales as '$(vLabelColumn2)'
RESIDENT Table1;

DROP TABLE Table1, Header;

Store TableToExport into [Table1.txt](txt, delimiter is '|');&lt;/PRE&gt;&lt;P&gt;But the solution isn't perfect because it includes the delimiter in the header &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;Total rows: 5| 
A|100
B|200
C|300
D|400
E|500&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Nov 2018 12:17:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Export-to-TXT-CSV-with-customized-header/m-p/1514808#M36696</guid>
      <dc:creator>albert_guito</dc:creator>
      <dc:date>2018-11-30T12:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Export to TXT/CSV with customized header</title>
      <link>https://community.qlik.com/t5/App-Development/Export-to-TXT-CSV-with-customized-header/m-p/1514829#M36698</link>
      <description>&lt;P&gt;If you&amp;nbsp;just use a little number of columns this would be a perfect solution:&lt;/P&gt;&lt;PRE&gt;Table1:
LOAD Customer &amp;amp; '|' &amp;amp; Sales as Reg INLINE [Customer, Sales
A,100
B,200
C,300
D,400
E,500
];

Header: Load 'Total rows: ' &amp;amp; Count(Reg) as numReg Resident Table1; 

LET vLabelColumn1 = peek('numReg',0,'Header');

TableToExport: LOAD PurgeChar(Reg,'"')	as '$(vLabelColumn1)' RESIDENT Table1;

DROP TABLE Table1, Header;

Store TableToExport into [Table1.txt](txt);&lt;/PRE&gt;&lt;P&gt;The result will be:&lt;/P&gt;&lt;PRE&gt;Total rows: 5
A|100
B|200
C|300
D|400
E|500&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Nov 2018 12:41:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Export-to-TXT-CSV-with-customized-header/m-p/1514829#M36698</guid>
      <dc:creator>albert_guito</dc:creator>
      <dc:date>2018-11-30T12:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Export to TXT/CSV with customized header</title>
      <link>https://community.qlik.com/t5/App-Development/Export-to-TXT-CSV-with-customized-header/m-p/1515159#M36714</link>
      <description>&lt;P&gt;Thanks, Albert! excellent solution!&lt;/P&gt;</description>
      <pubDate>Sat, 01 Dec 2018 07:45:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Export-to-TXT-CSV-with-customized-header/m-p/1515159#M36714</guid>
      <dc:creator>qhe</dc:creator>
      <dc:date>2018-12-01T07:45:10Z</dc:date>
    </item>
  </channel>
</rss>

