<?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: Looping  variable script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Looping-variable-script/m-p/1582272#M442982</link>
    <description>&lt;P&gt;Hi Marcus,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to be able to load data each Monday from the qvd file that gets created weekly (Monday).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can do this through a concatenated load but then I have to add to the script every week.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was trying to set up a variable in order to replace part of the Lib: and have them load every week. so week 1 i will have one data set week 52 52 data sets from each Monday.&amp;nbsp;&lt;/P&gt;&lt;P&gt;FROM [lib://CLM Snapshots (Weekly)/REP_Work_Order_$(vWeekStart).qvd](qvd)&lt;/P&gt;</description>
    <pubDate>Mon, 20 May 2019 14:32:54 GMT</pubDate>
    <dc:creator>mikegauntlett</dc:creator>
    <dc:date>2019-05-20T14:32:54Z</dc:date>
    <item>
      <title>Looping  variable script</title>
      <link>https://community.qlik.com/t5/QlikView/Looping-variable-script/m-p/1582259#M442980</link>
      <description>&lt;P&gt;Hi Guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;If i wanted to make vWeekStart = every Monday &amp;nbsp;from 2019-01-01, how would I achieve this ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have&amp;nbsp; the below so far&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let vStartDate =(2019-01-07);
let vEndDate = weekstart(today());
let vWeekStart = weekstart($(vStartDate));
let vNextWeekStart = $(vWeekStart) + 7;
let countloops = 0; //Just during test, to be able to exit loop
do while $(vWeekStart) &amp;lt;= $(vEndDate)
let vWeekStart = $(vNextWeekStart);
let vNextWeekStart = $(vWeekStart) + 7;
let vWeekName = weekyear($(vWeekStart))*100 + week($(vWeekStart));
let countloops = $(countloops) + 1;
exit do when $(countloops) &amp;gt; 3;
Loop&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Currently I get 1901 as an output.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need the format to be yyyy-MM-dd&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:31:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Looping-variable-script/m-p/1582259#M442980</guid>
      <dc:creator>mikegauntlett</dc:creator>
      <dc:date>2024-11-16T03:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Looping  variable script</title>
      <link>https://community.qlik.com/t5/QlikView/Looping-variable-script/m-p/1582269#M442981</link>
      <description>&lt;P&gt;For me it's not clear what do you tries to do. I suggest to rethink the whole approach with all the variables and to use instead a master-calendar and create there all needed fields respectively flags. More background could you find here: &lt;A href="https://community.qlik.com/t5/QlikView-Documents/How-to-use-Master-Calendar-and-Date-Values/ta-p/1495741" target="_self"&gt;How-to-use-Master-Calendar-and-Date-Values&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 14:27:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Looping-variable-script/m-p/1582269#M442981</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-05-20T14:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: Looping  variable script</title>
      <link>https://community.qlik.com/t5/QlikView/Looping-variable-script/m-p/1582272#M442982</link>
      <description>&lt;P&gt;Hi Marcus,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to be able to load data each Monday from the qvd file that gets created weekly (Monday).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can do this through a concatenated load but then I have to add to the script every week.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was trying to set up a variable in order to replace part of the Lib: and have them load every week. so week 1 i will have one data set week 52 52 data sets from each Monday.&amp;nbsp;&lt;/P&gt;&lt;P&gt;FROM [lib://CLM Snapshots (Weekly)/REP_Work_Order_$(vWeekStart).qvd](qvd)&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 14:32:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Looping-variable-script/m-p/1582272#M442982</guid>
      <dc:creator>mikegauntlett</dc:creator>
      <dc:date>2019-05-20T14:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: Looping  variable script</title>
      <link>https://community.qlik.com/t5/QlikView/Looping-variable-script/m-p/1582276#M442983</link>
      <description>&lt;P&gt;If you want to load always the file from the last monday you need just one variable which could be defined directly without any loop by using something like this: date(weekstart(today()), Format)&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 14:41:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Looping-variable-script/m-p/1582276#M442983</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-05-20T14:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Looping  variable script</title>
      <link>https://community.qlik.com/t5/QlikView/Looping-variable-script/m-p/1582285#M442984</link>
      <description>&lt;P&gt;Hi Marcus thank you for the assistance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I still get 1994 as the date from,&amp;nbsp;&lt;/P&gt;&lt;P&gt;let vWeekStart = weekstart (date(today(),'YYYY-MM-dd'));&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2019 14:55:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Looping-variable-script/m-p/1582285#M442984</guid>
      <dc:creator>mikegauntlett</dc:creator>
      <dc:date>2019-05-20T14:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Looping  variable script</title>
      <link>https://community.qlik.com/t5/QlikView/Looping-variable-script/m-p/1582555#M443003</link>
      <description>&lt;P&gt;Your approach and my suggestion isn't the same because you apply the weekstart as the most outer function and they will return a timestamp with the your default-format of a timestamp (the formatting in between will be meaningless).&lt;/P&gt;&lt;P&gt;Further your chosen formatting is not unproblematic because as far as your variable is expanded/evaluated a content like:&lt;/P&gt;&lt;PRE&gt;let vStartDate =(2019-01-07);&lt;/PRE&gt;&lt;P&gt;returned just 2011 because the "-" char will be handled as operator and it will be calculate the content.&lt;/P&gt;&lt;P&gt;This means your file-path might be look like:&lt;/P&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-main"&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-21 lia-quilt-column-right lia-quilt-column-main-content"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-right"&gt;&lt;DIV class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;FROM [lib://CLM Snapshots (Weekly)/REP_Work_Order&lt;STRONG&gt;_vWeekStart&lt;/STRONG&gt;.qvd] (qvd);&lt;/P&gt;&lt;DIV&gt;and sometimes it's also useful/necessary to build the whole file-path within a variable like:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;let vFilePath = '[lib://CLM Snapshots (Weekly)/REP_Work_Order_' &amp;amp; date(weekstart(today()), 'YYYY-MM-dd') &amp;amp; '.qvd]';&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;and then using:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;FROM$(vFilePath) (qvd);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;- Marcus&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 21 May 2019 08:03:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Looping-variable-script/m-p/1582555#M443003</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-05-21T08:03:01Z</dc:date>
    </item>
  </channel>
</rss>

