<?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: Loading Files on a Condition in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Loading-Files-on-a-Condition/m-p/1746781#M590669</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/126591"&gt;@FranziskaNewbie&lt;/a&gt;&amp;nbsp; I have added some information I hope this is useful for you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's suppose that the folder containing&amp;nbsp; csv files is vPath.&lt;/P&gt;&lt;P&gt;I go through all the files in the folder, and then in the name I added the date also as an indication&lt;/P&gt;&lt;LI-CODE lang="python"&gt;let vPath ='C:\Users\t.zarra\Downloads\Desktop\';

For each File in FileList('$(vPath)\*.csv')

let Vflag=wildmatch(Upper('$(File)'),'*MONTH*');
let Vtag=Date(today(),'YYYYMMDD');

if '$(Vflag)'=0 then 

		Table:
		
		Load *
		
		From $(File)
		(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);
		
		Store Table into '$(vPath)\$(Vtag)_weeklydata.qvd' (qvd);
		drop table Table;
		
else
		
		Table:
		
		Load *
		
		From $(File)
		(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);
		
		Store Table into '$(vPath)\$(Vtag)_monthlydata.qvd' (qvd);
		drop table Table;
		
endif
		

NEXT &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tested for this example :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 374px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/41145iC380C6EAE7253D87/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Sep 2020 11:40:58 GMT</pubDate>
    <dc:creator>Taoufiq_Zarra</dc:creator>
    <dc:date>2020-09-24T11:40:58Z</dc:date>
    <item>
      <title>Loading Files on a Condition</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-Files-on-a-Condition/m-p/1746758#M590668</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I am relatively new to QlikView.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two different types of csv files in one folder, monthly data and weekly data for example:&lt;BR /&gt;20200924_ABC_Month_STAT.csv&lt;BR /&gt;20200924_EFC_ABC.csv&lt;/P&gt;&lt;P&gt;If the Filename contains "Month" I want to load script A with the monthly data and store it in a "monthlydata.qvd".&lt;BR /&gt;If the Filename does not contain "Month" I want to load script B with the weekly data and store it in a "weeklydata.qvd".&lt;/P&gt;&lt;P&gt;I have tried this&lt;BR /&gt;&lt;EM&gt;if (Wildmatch($(vSourceFile), '*Month*')) THEN&lt;/EM&gt;&lt;BR /&gt;but it didn't work.&lt;/P&gt;&lt;P&gt;Can you please help me?&lt;/P&gt;&lt;P&gt;Thank you and best regards,&lt;/P&gt;&lt;P&gt;Franziska&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 18:03:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-Files-on-a-Condition/m-p/1746758#M590668</guid>
      <dc:creator>FranziskaNewbie</dc:creator>
      <dc:date>2024-11-16T18:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Files on a Condition</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-Files-on-a-Condition/m-p/1746781#M590669</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/126591"&gt;@FranziskaNewbie&lt;/a&gt;&amp;nbsp; I have added some information I hope this is useful for you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's suppose that the folder containing&amp;nbsp; csv files is vPath.&lt;/P&gt;&lt;P&gt;I go through all the files in the folder, and then in the name I added the date also as an indication&lt;/P&gt;&lt;LI-CODE lang="python"&gt;let vPath ='C:\Users\t.zarra\Downloads\Desktop\';

For each File in FileList('$(vPath)\*.csv')

let Vflag=wildmatch(Upper('$(File)'),'*MONTH*');
let Vtag=Date(today(),'YYYYMMDD');

if '$(Vflag)'=0 then 

		Table:
		
		Load *
		
		From $(File)
		(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);
		
		Store Table into '$(vPath)\$(Vtag)_weeklydata.qvd' (qvd);
		drop table Table;
		
else
		
		Table:
		
		Load *
		
		From $(File)
		(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);
		
		Store Table into '$(vPath)\$(Vtag)_monthlydata.qvd' (qvd);
		drop table Table;
		
endif
		

NEXT &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tested for this example :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 374px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/41145iC380C6EAE7253D87/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 11:40:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-Files-on-a-Condition/m-p/1746781#M590669</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-09-24T11:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Files on a Condition</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-Files-on-a-Condition/m-p/1746835#M590670</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/56648"&gt;@Taoufiq_Zarra&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Your solution worked perfectly, thank you so much!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 13:56:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-Files-on-a-Condition/m-p/1746835#M590670</guid>
      <dc:creator>FranziskaNewbie</dc:creator>
      <dc:date>2020-09-24T13:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Loading Files on a Condition</title>
      <link>https://community.qlik.com/t5/QlikView/Loading-Files-on-a-Condition/m-p/1829655#M1214354</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/56648"&gt;@Taoufiq_Zarra&lt;/a&gt;&amp;nbsp; and &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/126591"&gt;@FranziskaNewbie&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have similar problem .I want to separate the data load script based on filename. i am fetching data from SFTP server.&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="2"&gt;&lt;EM&gt;FilesAndFolders:&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="verdana,geneva" size="2"&gt;&lt;EM&gt;LOAD&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="verdana,geneva" size="2"&gt;&lt;EM&gt;Name,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="verdana,geneva" size="2"&gt;&lt;EM&gt;Path,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="verdana,geneva" size="2"&gt;&lt;EM&gt;IsDirectory,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="verdana,geneva" size="2"&gt;&lt;EM&gt;Size,&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="verdana,geneva" size="2"&gt;&lt;EM&gt;SubField(SubField(Name,' ',1),'_',2) as newfile&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="verdana,geneva" size="2"&gt;&lt;EM&gt;FROM [lib://sftp_url (allenlund_nprinting)]&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="2"&gt;&lt;EM&gt;(URL is [&lt;A href="http://qliksense:5555/data?connectorID=FileTransferConnector&amp;amp;table=SFTPListFilesAndFolders&amp;amp;host=harmony-la.allenlund.com&amp;amp;port=5022&amp;amp;userName=QlikServer&amp;amp;password=sta_gen_1%3aekhHROY5hOEHHqLj%2fHgFaQ%3d%3d%3aQ5a0YHe5UOEN%2fkNHJBVKuw%3d%3d&amp;amp;ignoreProxy=False&amp;amp;ignoreClientCertificateErrors=False&amp;amp;useLegacyGroupExchange=False&amp;amp;remoteDirectory=%2fhome%2fQlikServer%2foutbox%2f*.csv*&amp;amp;appID=],qvx" target="_blank"&gt;http://qliksense:5555/data?connectorID=FileTransferConnector&amp;amp;table=SFTPListFilesAndFolders&amp;amp;host=harmony-la.allenlund.com&amp;amp;port=5022&amp;amp;userName=QlikServer&amp;amp;password=sta_gen_1%3aekhHROY5hOEHHqLj%2fHgFaQ%3d%3d%3aQ5a0YHe5UOEN%2fkNHJBVKuw%3d%3d&amp;amp;ignoreProxy=False&amp;amp;ignoreClientCertificateErrors=False&amp;amp;useLegacyGroupExchange=False&amp;amp;remoteDirectory=%2fhome%2fQlikServer%2foutbox%2f*.csv*&amp;amp;appID=],qvx&lt;/A&gt;);&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="2"&gt;&lt;EM&gt;LET vNoOfFiles = NoOfRows('FilesAndFolders');&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="2"&gt;with the above script i get below output&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="2"&gt;i just want to make separate load script and separate qvd for &lt;STRONG&gt;weekly_3_day_rates&lt;/STRONG&gt; and &lt;STRONG&gt;weekly_7_day_rates .&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;as all tables contains same no of rows and columns.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="2"&gt;&lt;STRONG&gt;thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="verdana,geneva" size="2"&gt;&lt;EM&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="filelist.png" style="width: 818px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/60337iACACF0C3C632BAE2/image-size/large?v=v2&amp;amp;px=999" role="button" title="filelist.png" alt="filelist.png" /&gt;&lt;/span&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 08:19:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loading-Files-on-a-Condition/m-p/1829655#M1214354</guid>
      <dc:creator>Deepak_dhikale</dc:creator>
      <dc:date>2021-08-19T08:19:15Z</dc:date>
    </item>
  </channel>
</rss>

