<?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 use a variable as table name when loading excel files in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411991#M701719</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, when I step through the script a evaluates as &amp;lt;NULL&amp;gt; and it throws and error because the table is not identified as a result..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="21935" class="jive-image-thumbnail jive-image" onclick="" alt="_2012-09-17_14-50-20.png" src="https://community.qlik.com/legacyfs/online/21935__2012-09-17_14-50-20.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's very confusing for me!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Sep 2012 06:52:39 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-09-17T06:52:39Z</dc:date>
    <item>
      <title>How to use a variable as table name when loading excel files</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411989#M701717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First time poster here, so forgive any mistakes!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to use my load script to get data from a bunch of incremental excel files.&amp;nbsp; The files are ooxml format and share the same column structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What changes is the file name and the table name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" height="91" style="width: 268px; border: 1px solid #000000; height: 69px;" width="266"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;File name&lt;BR /&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;Table (sheet) name&lt;BR /&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20120901.xlsx&lt;/TD&gt;&lt;TD&gt;20120901&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20120916.xlsx&lt;/TD&gt;&lt;TD&gt;20120116&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;20120827.xlsx&lt;/TD&gt;&lt;TD&gt;20120827&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want is to:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Cycle through each file in the 'data' directory&lt;/LI&gt;&lt;LI&gt;Use the filename (without extension) as the table name in the load script&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I've come up with so far&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;SET vDataPath = '.\data\';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;DIRECTORY $(vDataPath);&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;FOR Each File in FileList ('*.xlsx')&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;LET a = FileBaseName($(File));&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;LOAD *&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;From $(File)&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;(ooxml, no labels, Table is $(a) );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically I know I've stuffed up somewhere, because when I step through the script a evaluates to NULL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suggestions please!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 05:37:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411989#M701717</guid>
      <dc:creator />
      <dc:date>2012-09-17T05:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a variable as table name when loading excel files</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411990#M701718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you checked the variable values once a failed load has finished? Should tell you where the error is. Looks ok to me I think although you need 'Next' at the end. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 06:47:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411990#M701718</guid>
      <dc:creator>Jason_Michaelides</dc:creator>
      <dc:date>2012-09-17T06:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a variable as table name when loading excel files</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411991#M701719</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, when I step through the script a evaluates as &amp;lt;NULL&amp;gt; and it throws and error because the table is not identified as a result..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="21935" class="jive-image-thumbnail jive-image" onclick="" alt="_2012-09-17_14-50-20.png" src="https://community.qlik.com/legacyfs/online/21935__2012-09-17_14-50-20.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's very confusing for me!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 06:52:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411991#M701719</guid>
      <dc:creator />
      <dc:date>2012-09-17T06:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a variable as table name when loading excel files</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411992#M701720</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;try with this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set Root=".\data\";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FOR Each File in FileList (Root&amp;amp;'*.xlsx')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;let temp=subfield('$(File)', '\' ,-1);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;let fileName=SubField('$(temp)','.', 1);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD * &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;From $(File)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(ooxml, no labels, Table is '$(fileName)' );&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;next File&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 07:20:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411992#M701720</guid>
      <dc:creator />
      <dc:date>2012-09-17T07:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a variable as table name when loading excel files</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411993#M701721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could also try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #636363; font-family: Arial; font-size: 12px; background-color: #eef4f9;"&gt;LET a = FileBaseName(&lt;STRONG&gt;'&lt;/STRONG&gt;$(File)&lt;STRONG&gt;'&lt;/STRONG&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 07:43:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411993#M701721</guid>
      <dc:creator>Jason_Michaelides</dc:creator>
      <dc:date>2012-09-17T07:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a variable as table name when loading excel files</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411994#M701722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is great, works like a charm!&amp;nbsp; Any change you could explain what the two let statements do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I'd love to understand why my original let a = FileBaseName($(File)) doesn't work!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 07:50:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411994#M701722</guid>
      <dc:creator />
      <dc:date>2012-09-17T07:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a variable as table name when loading excel files</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411995#M701723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;FileBaseName function returns name of the file currently being loaded.&lt;/P&gt;&lt;P&gt;In for each loop assigning to variable value of FileBaseName() will allways be null, as file is not loaded. To get file name, you should consider File variable as a string and parse what you need using SubField function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 08:36:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411995#M701723</guid>
      <dc:creator />
      <dc:date>2012-09-17T08:36:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a variable as table name when loading excel files</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411996#M701724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I didn't know that! Nice one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2012 11:56:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411996#M701724</guid>
      <dc:creator>Jason_Michaelides</dc:creator>
      <dc:date>2012-09-17T11:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a variable as table name when loading excel files</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411997#M701725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well as a first time experience asking for help on here, you guys have excelled yourselves!&amp;nbsp; Thanks so much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Sep 2012 00:04:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-use-a-variable-as-table-name-when-loading-excel-files/m-p/411997#M701725</guid>
      <dc:creator />
      <dc:date>2012-09-18T00:04:40Z</dc:date>
    </item>
  </channel>
</rss>

