<?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 Regarding a SUB and IF Statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Regarding-a-SUB-and-IF-Statement/m-p/754017#M268620</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;I am having an issue writing a&amp;nbsp; SUB Code that can be used to switch the table load code based on the type of file/table&lt;/P&gt;&lt;P&gt;such as '.qvd' or '.txt' being pulled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. vFILE is the variable name for the file being pulled, Its a text field&lt;/P&gt;&lt;P&gt;2. vFILETYPE&amp;nbsp; is the extension name such as 'qvd'&amp;nbsp; , 'txt' , 'xls'&amp;nbsp; etc&lt;/P&gt;&lt;P&gt;and accordingly the load statement below needs to be switched based on the file extension suppplied in the function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUB LOAD_CLAIMS(vFILE, vFILETYPE)&lt;BR /&gt;//===============================================================================&lt;BR /&gt;//===============================================================================&lt;BR /&gt;IF $(vFILETYPE) = 'txt'&lt;/P&gt;&lt;P&gt;THEN&lt;/P&gt;&lt;P&gt;$(vFILE):&lt;BR /&gt;LOAD *&lt;BR /&gt;FROM&lt;BR /&gt;[$(vPullPath)$(vFILE).txt]&lt;BR /&gt;(txt, codepage is 1252, embedded labels, delimiter is ',', msq);&lt;BR /&gt;//===============================================================================&lt;BR /&gt;STORE $(vFILE) INTO $(vStorePath)$(vFILE).QVD;&lt;BR /&gt;DROP TABLE $(vFILE);&lt;BR /&gt;//===============================================================================&lt;/P&gt;&lt;P&gt;ELSE&lt;/P&gt;&lt;P&gt;IF $(vFILETYPE) = 'qvd'&lt;/P&gt;&lt;P&gt;THEN&lt;/P&gt;&lt;P&gt;$(vFILE):&lt;BR /&gt;LOAD *&lt;BR /&gt;FROM&lt;BR /&gt;[$(vPullPath)$(vFILE).qvd]&lt;BR /&gt;(qvd);&lt;BR /&gt;//===============================================================================&lt;BR /&gt;STORE $(vFILE) INTO $(vStorePath)$(vFILE).QVD;&lt;BR /&gt;DROP TABLE $(vFILE);&lt;BR /&gt;//===============================================================================&lt;/P&gt;&lt;P&gt;ENDIF&lt;/P&gt;&lt;P&gt;//===============================================================================&lt;/P&gt;&lt;P&gt;END SUB&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Dec 2014 21:39:47 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-12-01T21:39:47Z</dc:date>
    <item>
      <title>Regarding a SUB and IF Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Regarding-a-SUB-and-IF-Statement/m-p/754017#M268620</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;I am having an issue writing a&amp;nbsp; SUB Code that can be used to switch the table load code based on the type of file/table&lt;/P&gt;&lt;P&gt;such as '.qvd' or '.txt' being pulled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. vFILE is the variable name for the file being pulled, Its a text field&lt;/P&gt;&lt;P&gt;2. vFILETYPE&amp;nbsp; is the extension name such as 'qvd'&amp;nbsp; , 'txt' , 'xls'&amp;nbsp; etc&lt;/P&gt;&lt;P&gt;and accordingly the load statement below needs to be switched based on the file extension suppplied in the function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUB LOAD_CLAIMS(vFILE, vFILETYPE)&lt;BR /&gt;//===============================================================================&lt;BR /&gt;//===============================================================================&lt;BR /&gt;IF $(vFILETYPE) = 'txt'&lt;/P&gt;&lt;P&gt;THEN&lt;/P&gt;&lt;P&gt;$(vFILE):&lt;BR /&gt;LOAD *&lt;BR /&gt;FROM&lt;BR /&gt;[$(vPullPath)$(vFILE).txt]&lt;BR /&gt;(txt, codepage is 1252, embedded labels, delimiter is ',', msq);&lt;BR /&gt;//===============================================================================&lt;BR /&gt;STORE $(vFILE) INTO $(vStorePath)$(vFILE).QVD;&lt;BR /&gt;DROP TABLE $(vFILE);&lt;BR /&gt;//===============================================================================&lt;/P&gt;&lt;P&gt;ELSE&lt;/P&gt;&lt;P&gt;IF $(vFILETYPE) = 'qvd'&lt;/P&gt;&lt;P&gt;THEN&lt;/P&gt;&lt;P&gt;$(vFILE):&lt;BR /&gt;LOAD *&lt;BR /&gt;FROM&lt;BR /&gt;[$(vPullPath)$(vFILE).qvd]&lt;BR /&gt;(qvd);&lt;BR /&gt;//===============================================================================&lt;BR /&gt;STORE $(vFILE) INTO $(vStorePath)$(vFILE).QVD;&lt;BR /&gt;DROP TABLE $(vFILE);&lt;BR /&gt;//===============================================================================&lt;/P&gt;&lt;P&gt;ENDIF&lt;/P&gt;&lt;P&gt;//===============================================================================&lt;/P&gt;&lt;P&gt;END SUB&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Dec 2014 21:39:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Regarding-a-SUB-and-IF-Statement/m-p/754017#M268620</guid>
      <dc:creator />
      <dc:date>2014-12-01T21:39:47Z</dc:date>
    </item>
  </channel>
</rss>

