<?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: Loop through multiple csv files and store into qvd for each csv file dynamically in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Loop-through-multiple-csv-files-and-store-into-qvd-for-each-csv/m-p/1524524#M599963</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Below is the example that worked for me. You tweak the code as required&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FOR&lt;/STRONG&gt; Each &lt;STRONG&gt;&lt;EM&gt;vFile&lt;/EM&gt;&lt;/STRONG&gt; in filelist ('*sales_fact.csv')&lt;BR /&gt;FactSales:&lt;BR /&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;OrderDate, Customer,Product,Sales,Qty&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,FileName() as FileName&lt;BR /&gt;FROM&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;$(vFile)&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;(txt, codepage is 1252, embedded labels, delimiter is ',', msq);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Next&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM&gt;vFile&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Store&amp;nbsp;&lt;SPAN&gt;FactSales into&amp;nbsp;FactSales.qvd (qvd) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Dec 2018 18:39:03 GMT</pubDate>
    <dc:creator>skamath1</dc:creator>
    <dc:date>2018-12-27T18:39:03Z</dc:date>
    <item>
      <title>Loop through multiple csv files and store into qvd for each csv file dynamically - Qlik Sense</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-through-multiple-csv-files-and-store-into-qvd-for-each-csv/m-p/1524501#M599960</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a requirement to load multiple monthly csv files from a directory and store as separate qvd for each file.&lt;/P&gt;&lt;P&gt;I have created a variable for the latest YYYYMM and can load all the records into a single qvd. But I wanted to load each csv into a qvd.&lt;/P&gt;&lt;P&gt;E.G:&lt;/P&gt;&lt;P&gt;Productinformaion_8900752613_28500_20180702_01.csv&lt;BR /&gt;i.e: Productinformaion_productnumber_categorycode_YYYYMMDD_01.csv&lt;/P&gt;&lt;P&gt;I have seen some posts on the community for Qlik view&amp;nbsp; but those are not working in Qlik sense!&lt;/P&gt;&lt;P&gt;For example, there is a script with&lt;/P&gt;&lt;P&gt;ODBC connect to 'path&amp;nbsp; ';&lt;/P&gt;&lt;P&gt;Exceltables:&lt;/P&gt;&lt;P&gt;SQLTABLES;&lt;/P&gt;&lt;P&gt;DISCONNECT;&lt;/P&gt;&lt;P&gt;For I = 0 to NoOfRows('Exceltable')-1;&lt;/P&gt;&lt;P&gt;Load *&lt;/P&gt;&lt;P&gt;…..&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone suggest a solution please?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;SB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 04:53:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-through-multiple-csv-files-and-store-into-qvd-for-each-csv/m-p/1524501#M599960</guid>
      <dc:creator>sudhakar_budde</dc:creator>
      <dc:date>2024-11-16T04:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through multiple csv files and store into qvd for each csv file dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-through-multiple-csv-files-and-store-into-qvd-for-each-csv/m-p/1524504#M599961</link>
      <description>&lt;P&gt;Try the For each option in the script.&lt;/P&gt;&lt;P&gt;Review the help available with examples&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptControlStatements/For%20Each.htm" target="_blank"&gt;https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/ScriptControlStatements/For%20Each.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Dec 2018 16:55:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-through-multiple-csv-files-and-store-into-qvd-for-each-csv/m-p/1524504#M599961</guid>
      <dc:creator>skamath1</dc:creator>
      <dc:date>2018-12-27T16:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through multiple csv files and store into qvd for each csv file dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-through-multiple-csv-files-and-store-into-qvd-for-each-csv/m-p/1524518#M599962</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for your response.&lt;/P&gt;&lt;P&gt;I tried similar script, but it's not working!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;SB&lt;/P&gt;</description>
      <pubDate>Thu, 27 Dec 2018 17:57:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-through-multiple-csv-files-and-store-into-qvd-for-each-csv/m-p/1524518#M599962</guid>
      <dc:creator>sudhakar_budde</dc:creator>
      <dc:date>2018-12-27T17:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through multiple csv files and store into qvd for each csv file dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-through-multiple-csv-files-and-store-into-qvd-for-each-csv/m-p/1524524#M599963</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Below is the example that worked for me. You tweak the code as required&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FOR&lt;/STRONG&gt; Each &lt;STRONG&gt;&lt;EM&gt;vFile&lt;/EM&gt;&lt;/STRONG&gt; in filelist ('*sales_fact.csv')&lt;BR /&gt;FactSales:&lt;BR /&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;OrderDate, Customer,Product,Sales,Qty&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,FileName() as FileName&lt;BR /&gt;FROM&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;$(vFile)&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR /&gt;(txt, codepage is 1252, embedded labels, delimiter is ',', msq);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Next&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM&gt;vFile&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Store&amp;nbsp;&lt;SPAN&gt;FactSales into&amp;nbsp;FactSales.qvd (qvd) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Dec 2018 18:39:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-through-multiple-csv-files-and-store-into-qvd-for-each-csv/m-p/1524524#M599963</guid>
      <dc:creator>skamath1</dc:creator>
      <dc:date>2018-12-27T18:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through multiple csv files and store into qvd for each csv file dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-through-multiple-csv-files-and-store-into-qvd-for-each-csv/m-p/1524760#M599964</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have achieved the solution that I wanted by using the below script:&lt;/P&gt;&lt;P&gt;//***This script helps to load each csv file dated Current Month in its name from a source folder and store as a separate qvd in another folder. ***//&lt;/P&gt;&lt;P&gt;//**======================================================================&lt;/P&gt;&lt;P&gt;// ***Define the Path ****&lt;/P&gt;&lt;P&gt;LET vFilePath = 'lib://Sales Source Files/';&lt;BR /&gt;Let vQvdPath = 'lib://Sales Qvds/';&lt;BR /&gt;Let vCurrentMonthYear = Date(Today(),'YYYYMM');&lt;/P&gt;&lt;P&gt;//*** Start of the For loop ****&lt;/P&gt;&lt;P&gt;FOR EACH file in FileList('$(vFilePath)\Sales_*$(vCurrentMonthYear)*.csv'); ///***** the back slash '\' in the path is important to notice here ***** ///&lt;/P&gt;&lt;P&gt;SalesData:&lt;BR /&gt;Load&lt;BR /&gt;@1 AS Product_Name,&lt;BR /&gt;@2 AS Unit_Price,&lt;BR /&gt;@3 AS Location,&lt;BR /&gt;@4 AS Quantity,&lt;BR /&gt;@5 AS "Total Amount",&lt;BR /&gt;Left(filename(), 63) as filename&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;///**** I wanted certain details in the file name so used appropriately ****//&lt;BR /&gt;From&lt;BR /&gt;[$(file)]&lt;/P&gt;&lt;P&gt;(txt, codepage is 28591, no labels, delimiter is ',', msq, header is 2 lines) //*** I have to skip 2 header lines for my requirement ***//&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;Let vFileName = Peek('filename');&lt;BR /&gt;Store SalesData into [$(vQvdPath)$(vFileName).qvd] (qvd); // *** Storing as separate qvds ***//&lt;/P&gt;&lt;P&gt;Drop Table SalesData;&lt;/P&gt;&lt;P&gt;Next; // *** End of For loop ***//&lt;BR /&gt;Exit Script;&lt;/P&gt;&lt;P&gt;//============================================================================&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I hope this might help some other community members!&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;SB&lt;/P&gt;</description>
      <pubDate>Fri, 28 Dec 2018 10:13:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-through-multiple-csv-files-and-store-into-qvd-for-each-csv/m-p/1524760#M599964</guid>
      <dc:creator>sudhakar_budde</dc:creator>
      <dc:date>2018-12-28T10:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through multiple csv files and store into qvd for each csv file dynamically</title>
      <link>https://community.qlik.com/t5/QlikView/Loop-through-multiple-csv-files-and-store-into-qvd-for-each-csv/m-p/1524763#M599965</link>
      <description>Hi Skamath,&lt;BR /&gt;Thanks for your response.&lt;BR /&gt;Much appreciated for your efforts to help me out!&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;SB</description>
      <pubDate>Fri, 28 Dec 2018 10:15:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Loop-through-multiple-csv-files-and-store-into-qvd-for-each-csv/m-p/1524763#M599965</guid>
      <dc:creator>sudhakar_budde</dc:creator>
      <dc:date>2018-12-28T10:15:38Z</dc:date>
    </item>
  </channel>
</rss>

