<?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 Including source file name as a field in the import script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Including-source-file-name-as-a-field-in-the-import-script/m-p/204353#M61295</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;BR /&gt;I am importing from several source files, so to import from all of them in one go I'm doing something like:&lt;BR /&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;LOAD @1:6 as HDR,&lt;BR /&gt; @7:11 as Comp,&lt;BR /&gt; @12:22 as [Doc Number],&lt;BR /&gt; @23:27 as Year&lt;BR /&gt;FROM&lt;BR /&gt;&lt;D&gt;&lt;BR /&gt;&lt;/D&gt;&lt;/PRE&gt;&lt;BR /&gt;However, what I'd really like to do is include the file name as a field in the script. So something like:&lt;BR /&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;For Each file in D:\QlikView\Sourcefiles\&lt;BR /&gt; vFilename = file.name&lt;BR /&gt; LOAD @1:6 as HDR,&lt;BR /&gt; @7:11 as Comp,&lt;BR /&gt; @12:22 as [Doc Number],&lt;BR /&gt; @23:27 as Year,&lt;BR /&gt; vFilename as FileName&lt;BR /&gt; FROM&lt;BR /&gt; &lt;D&gt;&lt;BR /&gt;Next&lt;BR /&gt;&lt;/D&gt;&lt;/PRE&gt;&lt;BR /&gt;I'm guessing this isn't possible how I've written it, but does anyone know a way I can do this?&lt;BR /&gt;Many thanks,&lt;BR /&gt;Tony&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Sep 2010 12:29:19 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-09-16T12:29:19Z</dc:date>
    <item>
      <title>Including source file name as a field in the import script</title>
      <link>https://community.qlik.com/t5/QlikView/Including-source-file-name-as-a-field-in-the-import-script/m-p/204353#M61295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;BR /&gt;I am importing from several source files, so to import from all of them in one go I'm doing something like:&lt;BR /&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;LOAD @1:6 as HDR,&lt;BR /&gt; @7:11 as Comp,&lt;BR /&gt; @12:22 as [Doc Number],&lt;BR /&gt; @23:27 as Year&lt;BR /&gt;FROM&lt;BR /&gt;&lt;D&gt;&lt;BR /&gt;&lt;/D&gt;&lt;/PRE&gt;&lt;BR /&gt;However, what I'd really like to do is include the file name as a field in the script. So something like:&lt;BR /&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;For Each file in D:\QlikView\Sourcefiles\&lt;BR /&gt; vFilename = file.name&lt;BR /&gt; LOAD @1:6 as HDR,&lt;BR /&gt; @7:11 as Comp,&lt;BR /&gt; @12:22 as [Doc Number],&lt;BR /&gt; @23:27 as Year,&lt;BR /&gt; vFilename as FileName&lt;BR /&gt; FROM&lt;BR /&gt; &lt;D&gt;&lt;BR /&gt;Next&lt;BR /&gt;&lt;/D&gt;&lt;/PRE&gt;&lt;BR /&gt;I'm guessing this isn't possible how I've written it, but does anyone know a way I can do this?&lt;BR /&gt;Many thanks,&lt;BR /&gt;Tony&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Sep 2010 12:29:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Including-source-file-name-as-a-field-in-the-import-script/m-p/204353#M61295</guid>
      <dc:creator />
      <dc:date>2010-09-16T12:29:19Z</dc:date>
    </item>
    <item>
      <title>Including source file name as a field in the import script</title>
      <link>https://community.qlik.com/t5/QlikView/Including-source-file-name-as-a-field-in-the-import-script/m-p/204354#M61296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If i understood your question, below is the code for you problem&lt;/P&gt;&lt;P&gt;LOAD @1:6 as HDR,&lt;BR /&gt; @7:11 as Comp,&lt;BR /&gt; @12:22 as [Doc Number],&lt;BR /&gt; @23:27 as Year,&lt;BR /&gt; filebasename() as FileName&lt;BR /&gt; FROM&lt;BR /&gt; &lt;D&gt;&lt;/D&gt;&lt;/P&gt;&lt;P&gt;Hope this will help you.&lt;/P&gt;&lt;P&gt;- Sridhar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Sep 2010 13:38:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Including-source-file-name-as-a-field-in-the-import-script/m-p/204354#M61296</guid>
      <dc:creator />
      <dc:date>2010-09-16T13:38:51Z</dc:date>
    </item>
    <item>
      <title>Including source file name as a field in the import script</title>
      <link>https://community.qlik.com/t5/QlikView/Including-source-file-name-as-a-field-in-the-import-script/m-p/204355#M61297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Sridhar, that's perfect.&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Tony&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Sep 2010 16:19:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Including-source-file-name-as-a-field-in-the-import-script/m-p/204355#M61297</guid>
      <dc:creator />
      <dc:date>2010-09-16T16:19:20Z</dc:date>
    </item>
  </channel>
</rss>

