<?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 Change variable if files don't exist in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Change-variable-if-files-don-t-exist/m-p/1795147#M1211118</link>
    <description>&lt;P&gt;Good morning,&amp;nbsp;&lt;BR /&gt;I am looking for a way to change a path variable. If the files do not exist in the RAW folder, load them from another folder.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is important to use the number of files instead of EXISTS because some projects will have more files than others.&amp;nbsp;&lt;/P&gt;&lt;P&gt;// This section counts the QVD's - In this case I get 3&lt;BR /&gt;Set vRoot = 'C:\RAW\Sense_QVDs';&lt;/P&gt;&lt;P&gt;Sub NoOfFiles(myPath, myNoOfFiles)&lt;BR /&gt;// Count the number of files, meeting creteria, in a path&lt;BR /&gt;Let tNoOfFiles = 0;&lt;BR /&gt;For Each File In Filelist ('$(myPath)')&lt;BR /&gt;// Count +1 for each file in the path&lt;BR /&gt;Let tNoOfFiles = tNoOfFiles + 1;&lt;BR /&gt;Next&lt;BR /&gt;Let $(myNoOfFiles) = tNoOfFiles; // Declare the variable and set the value&lt;BR /&gt;Set tNoOfFiles=; // Undeclare&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;// Save the NoOfFiles in variable "vNoOfFiles"&lt;BR /&gt;Call NoOfFiles('$(vRoot)\Min_v0_*.qvd', 'vNoOfFiles')&lt;/P&gt;&lt;P&gt;// At this stage I have 3 QVD's&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;IF $(NoOfFiles) = 3 THEN&lt;/P&gt;&lt;P&gt;SET vRAW_QVDFolder = [C:\RAW\Sense_QVDs];&lt;BR /&gt;SET vWorking_QVDFolder = [C:\Projects\ProductionData];&lt;/P&gt;&lt;P&gt;ELSE&lt;/P&gt;&lt;P&gt;SET vRAW_QVDFolder = [C:\Projects\ProductionData];&lt;BR /&gt;SET vWorking_QVDFolder = [C:\RAW\Sense_QVDs];&lt;/P&gt;&lt;P&gt;ENDIF&lt;/P&gt;&lt;P&gt;.......&lt;/P&gt;&lt;P&gt;Thank you very much for you assistance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Mar 2021 02:04:06 GMT</pubDate>
    <dc:creator>johngouws</dc:creator>
    <dc:date>2021-03-29T02:04:06Z</dc:date>
    <item>
      <title>Change variable if files don't exist</title>
      <link>https://community.qlik.com/t5/QlikView/Change-variable-if-files-don-t-exist/m-p/1795147#M1211118</link>
      <description>&lt;P&gt;Good morning,&amp;nbsp;&lt;BR /&gt;I am looking for a way to change a path variable. If the files do not exist in the RAW folder, load them from another folder.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is important to use the number of files instead of EXISTS because some projects will have more files than others.&amp;nbsp;&lt;/P&gt;&lt;P&gt;// This section counts the QVD's - In this case I get 3&lt;BR /&gt;Set vRoot = 'C:\RAW\Sense_QVDs';&lt;/P&gt;&lt;P&gt;Sub NoOfFiles(myPath, myNoOfFiles)&lt;BR /&gt;// Count the number of files, meeting creteria, in a path&lt;BR /&gt;Let tNoOfFiles = 0;&lt;BR /&gt;For Each File In Filelist ('$(myPath)')&lt;BR /&gt;// Count +1 for each file in the path&lt;BR /&gt;Let tNoOfFiles = tNoOfFiles + 1;&lt;BR /&gt;Next&lt;BR /&gt;Let $(myNoOfFiles) = tNoOfFiles; // Declare the variable and set the value&lt;BR /&gt;Set tNoOfFiles=; // Undeclare&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;// Save the NoOfFiles in variable "vNoOfFiles"&lt;BR /&gt;Call NoOfFiles('$(vRoot)\Min_v0_*.qvd', 'vNoOfFiles')&lt;/P&gt;&lt;P&gt;// At this stage I have 3 QVD's&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;IF $(NoOfFiles) = 3 THEN&lt;/P&gt;&lt;P&gt;SET vRAW_QVDFolder = [C:\RAW\Sense_QVDs];&lt;BR /&gt;SET vWorking_QVDFolder = [C:\Projects\ProductionData];&lt;/P&gt;&lt;P&gt;ELSE&lt;/P&gt;&lt;P&gt;SET vRAW_QVDFolder = [C:\Projects\ProductionData];&lt;BR /&gt;SET vWorking_QVDFolder = [C:\RAW\Sense_QVDs];&lt;/P&gt;&lt;P&gt;ENDIF&lt;/P&gt;&lt;P&gt;.......&lt;/P&gt;&lt;P&gt;Thank you very much for you assistance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Mar 2021 02:04:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-variable-if-files-don-t-exist/m-p/1795147#M1211118</guid>
      <dc:creator>johngouws</dc:creator>
      <dc:date>2021-03-29T02:04:06Z</dc:date>
    </item>
  </channel>
</rss>

