<?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 Don't store a table if no data in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Don-t-store-a-table-if-no-data/m-p/972759#M975708</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi -&amp;nbsp; I have a script that pulls in a QVD containing a year's worth of data, then exports it into individual monthly files.&amp;nbsp;&amp;nbsp;&amp;nbsp; It's a universal scrip that I'm applying to a large amount of different QVDs.&amp;nbsp; Not all QVDs have a full year of data.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The script runs fine as if there is no data for a month in the QVD it creates a table with 0 rows imported, however it then creates an empty&amp;nbsp; QVD file.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An example below - Load table is the possibly yearly dataset, and table 01 is pulling out just the January data.&amp;nbsp;&amp;nbsp; So what can I add in that if there is no Jan data, then don't STORE and just drop the table.&amp;nbsp;&amp;nbsp; Assuming and If Then Else statement, but what's the syntax to put into the If/Then to check the table size ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD:&lt;/P&gt;&lt;P&gt;Load * from xxxxx.qvd (qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;01:&lt;/P&gt;&lt;P&gt;&amp;nbsp; NoConcatenate&lt;/P&gt;&lt;P&gt;&amp;nbsp; Load *&lt;/P&gt;&lt;P&gt;&amp;nbsp; Resident LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp; where&lt;/P&gt;&lt;P&gt;&amp;nbsp; (DateMonth&amp;nbsp; = 'Jan' and DateYear ='$(Year)');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; STORE 01 into $(vQVDDirectory)$(vCube)$(Year)01.qvd;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Drop table 01; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Dave&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Sep 2015 05:50:07 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-09-04T05:50:07Z</dc:date>
    <item>
      <title>Don't store a table if no data</title>
      <link>https://community.qlik.com/t5/QlikView/Don-t-store-a-table-if-no-data/m-p/972759#M975708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi -&amp;nbsp; I have a script that pulls in a QVD containing a year's worth of data, then exports it into individual monthly files.&amp;nbsp;&amp;nbsp;&amp;nbsp; It's a universal scrip that I'm applying to a large amount of different QVDs.&amp;nbsp; Not all QVDs have a full year of data.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The script runs fine as if there is no data for a month in the QVD it creates a table with 0 rows imported, however it then creates an empty&amp;nbsp; QVD file.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An example below - Load table is the possibly yearly dataset, and table 01 is pulling out just the January data.&amp;nbsp;&amp;nbsp; So what can I add in that if there is no Jan data, then don't STORE and just drop the table.&amp;nbsp;&amp;nbsp; Assuming and If Then Else statement, but what's the syntax to put into the If/Then to check the table size ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD:&lt;/P&gt;&lt;P&gt;Load * from xxxxx.qvd (qvd);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;01:&lt;/P&gt;&lt;P&gt;&amp;nbsp; NoConcatenate&lt;/P&gt;&lt;P&gt;&amp;nbsp; Load *&lt;/P&gt;&lt;P&gt;&amp;nbsp; Resident LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp; where&lt;/P&gt;&lt;P&gt;&amp;nbsp; (DateMonth&amp;nbsp; = 'Jan' and DateYear ='$(Year)');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; STORE 01 into $(vQVDDirectory)$(vCube)$(Year)01.qvd;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Drop table 01; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Dave&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Sep 2015 05:50:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Don-t-store-a-table-if-no-data/m-p/972759#M975708</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-04T05:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Don't store a table if no data</title>
      <link>https://community.qlik.com/t5/QlikView/Don-t-store-a-table-if-no-data/m-p/972760#M975709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;T01:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;NoConcatenate&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Load * Resident LOAD&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;where (DateMonth&amp;nbsp; = 'Jan' and DateYear ='$(Year)');&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;If NoOfRows('T01') &amp;gt; 0 Then&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; STORE T01 into $(vQVDDirectory)$(vCube)$(Year)01.qvd;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Drop table T01;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;End If&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I changed the table name to avoid the need for delimiters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Sep 2015 05:54:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Don-t-store-a-table-if-no-data/m-p/972760#M975709</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-09-04T05:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Don't store a table if no data</title>
      <link>https://community.qlik.com/t5/QlikView/Don-t-store-a-table-if-no-data/m-p/972761#M975710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;filesize( )&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Sep 2015 05:56:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Don-t-store-a-table-if-no-data/m-p/972761#M975710</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2015-09-04T05:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Don't store a table if no data</title>
      <link>https://community.qlik.com/t5/QlikView/Don-t-store-a-table-if-no-data/m-p/972762#M975711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks - I also solved using&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;If RowNo() = 0 &lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then Drop table 01;&lt;/P&gt;&lt;P&gt;ELSE&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;STORE 01 into $(vQVDDirectory)$(vCube)$(Year)01.qvd;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop table 01;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit :&amp;nbsp; I've just expanded this script to contain multiple IF statements on multiple tables.&amp;nbsp;&amp;nbsp; For anyone reading this, RowNo() only works on the original table.&amp;nbsp;&amp;nbsp; If you are creating multiple sub tables from the source table, such as in my case with a multiple If Where clauses, RowNo() will run but will always return 0 so doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use on multiple subtables use Jonathan's answer :&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;EM style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;NoOfRows('T01') &amp;gt; &lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Sep 2015 06:01:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Don-t-store-a-table-if-no-data/m-p/972762#M975711</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-04T06:01:43Z</dc:date>
    </item>
  </channel>
</rss>

