<?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: Dynamic update variable to use in Where clause in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Dynamic-update-variable-to-use-in-Where-clause/m-p/1988972#M81729</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/17935"&gt;@MayilVahanan&lt;/a&gt;&amp;nbsp;.&amp;nbsp;&lt;BR /&gt;That is exactly what I needed. ✔ I appreciate it very much.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/155226"&gt;@justISO&lt;/a&gt;&amp;nbsp;- Your solution also works, but the /7 ties me into the first week. The solution from&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/17935"&gt;@MayilVahanan&lt;/a&gt;&amp;nbsp;I think gives me more options.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks very much.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Oct 2022 07:27:29 GMT</pubDate>
    <dc:creator>johngouws</dc:creator>
    <dc:date>2022-10-05T07:27:29Z</dc:date>
    <item>
      <title>Dynamic update variable to use in Where clause</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-update-variable-to-use-in-Where-clause/m-p/1988940#M81724</link>
      <description>&lt;P&gt;Good morning.&lt;/P&gt;
&lt;P&gt;I have a case where I need to load data for specific customers. The difference from the 'norm' is that for discussion purposes, different codes are loaded on each Monday of the month. I have this working manually when I set a variable before the load. eg: SET vReportWeek = 1; &lt;BR /&gt;However, I would like to make this dynamic. I have the code to identify the relevant Monday, but when I try to use the value in the varaiable is where I am having the issue.&lt;/P&gt;
&lt;P&gt;My Load script is below with the variable set manually.&lt;/P&gt;
&lt;P&gt;SET vReportWeek = 1;&lt;BR /&gt;//SET vReportWeek = "=max(Week_no)";&lt;/P&gt;
&lt;P&gt;t0:&lt;BR /&gt;Load * INLINE [&lt;BR /&gt;Code , Monday1 ,Monday2 ,Monday3 ,Monday4&lt;BR /&gt;AAA000 , x , , ,x &lt;BR /&gt;AAB000 , ,x , ,x &lt;BR /&gt;AAC000 , , ,x ,x &lt;BR /&gt;AAD000 , x , , ,x &lt;BR /&gt;AAE000 , ,x , ,x &lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;/P&gt;
&lt;P&gt;t1:&lt;BR /&gt;Load &lt;BR /&gt;*,&lt;BR /&gt;if(DayName(MonthStart(Today()),Mod(7-WeekDay(MonthStart(Today())),7)) = Today(), 1,&lt;BR /&gt;if(DayName(MonthStart(Today()),Mod(7-WeekDay(MonthStart(Today())),7)+7) = Today(), 2,&lt;BR /&gt;if(DayName(MonthStart(Today()),Mod(7-WeekDay(MonthStart(Today())),7)+14) = Today(), 3,&lt;BR /&gt;if(DayName(MonthStart(Today()),Mod(7-WeekDay(MonthStart(Today())),7)+21) = Today(), 4,&lt;BR /&gt;if(DayName(MonthStart(Today()),Mod(7-WeekDay(MonthStart(Today())),7)+28) = Today(), 4,&lt;BR /&gt;1 //Normally 0 - 1 for testing&lt;BR /&gt;))))) as Week_no&lt;BR /&gt;Resident t0;&lt;BR /&gt;Drop Table t0;&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;/P&gt;
&lt;P&gt;t2:&lt;BR /&gt;Load &lt;BR /&gt;*&lt;BR /&gt;Resident t1&lt;BR /&gt;Where Monday$(vReportWeek) = 'x';&lt;BR /&gt;Drop Table t1;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Thank you - I appreciate any advice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 06:46:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-update-variable-to-use-in-Where-clause/m-p/1988940#M81724</guid>
      <dc:creator>johngouws</dc:creator>
      <dc:date>2022-10-05T06:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic update variable to use in Where clause</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-update-variable-to-use-in-Where-clause/m-p/1988956#M81725</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;Try like below, hope it helps&lt;/P&gt;
&lt;P&gt;t1:&lt;BR /&gt;Load&lt;BR /&gt;*,&lt;BR /&gt;if(DayName(MonthStart(Today()),Mod(7-WeekDay(MonthStart(Today())),7)) = Today(), 1,&lt;BR /&gt;if(DayName(MonthStart(Today()),Mod(7-WeekDay(MonthStart(Today())),7)+7) = Today(), 2,&lt;BR /&gt;if(DayName(MonthStart(Today()),Mod(7-WeekDay(MonthStart(Today())),7)+14) = Today(), 3,&lt;BR /&gt;if(DayName(MonthStart(Today()),Mod(7-WeekDay(MonthStart(Today())),7)+21) = Today(), 4,&lt;BR /&gt;if(DayName(MonthStart(Today()),Mod(7-WeekDay(MonthStart(Today())),7)+28) = Today(), 4,&lt;BR /&gt;1 //Normally 0 - 1 for testing&lt;BR /&gt;))))) as Week_no&lt;BR /&gt;Resident t0;&lt;BR /&gt;Drop Table t0;&lt;/P&gt;
&lt;P&gt;temp:&lt;BR /&gt;&lt;STRONG&gt;Load Max(Week_no) as MaxWk Resident t1;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;LET vReportWeek = peek('MaxWk');&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;TRACE vReportWeek -- $(vReportWeek);&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;/P&gt;
&lt;P&gt;t2:&lt;BR /&gt;Load&lt;BR /&gt;*&lt;BR /&gt;Resident t1&lt;BR /&gt;Where Monday&lt;STRONG&gt;$(vReportWeek)&lt;/STRONG&gt; = 'x';&lt;BR /&gt;Drop Table t1, temp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 07:02:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-update-variable-to-use-in-Where-clause/m-p/1988956#M81725</guid>
      <dc:creator>MayilVahanan</dc:creator>
      <dc:date>2022-10-05T07:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic update variable to use in Where clause</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-update-variable-to-use-in-Where-clause/m-p/1988960#M81727</link>
      <description>&lt;P&gt;Hi, what about instead of&lt;/P&gt;
&lt;P&gt;SET vReportWeek = 1;&lt;/P&gt;
&lt;P&gt;use&lt;/P&gt;
&lt;P&gt;LET vReportWeek = Ceil(Day(Today())/7);&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 07:09:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-update-variable-to-use-in-Where-clause/m-p/1988960#M81727</guid>
      <dc:creator>justISO</dc:creator>
      <dc:date>2022-10-05T07:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic update variable to use in Where clause</title>
      <link>https://community.qlik.com/t5/App-Development/Dynamic-update-variable-to-use-in-Where-clause/m-p/1988972#M81729</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/17935"&gt;@MayilVahanan&lt;/a&gt;&amp;nbsp;.&amp;nbsp;&lt;BR /&gt;That is exactly what I needed. ✔ I appreciate it very much.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/155226"&gt;@justISO&lt;/a&gt;&amp;nbsp;- Your solution also works, but the /7 ties me into the first week. The solution from&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/17935"&gt;@MayilVahanan&lt;/a&gt;&amp;nbsp;I think gives me more options.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks very much.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 07:27:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Dynamic-update-variable-to-use-in-Where-clause/m-p/1988972#M81729</guid>
      <dc:creator>johngouws</dc:creator>
      <dc:date>2022-10-05T07:27:29Z</dc:date>
    </item>
  </channel>
</rss>

