<?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: Script issue setting variable:  Server update vs manual update in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1518189#M437224</link>
    <description>&lt;P&gt;Why &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;Num(Expression, '#0')&lt;/FONT&gt;&lt;/STRONG&gt; required? Instead can't you use simply &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Num(Expression, 00)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 08 Dec 2018 00:26:46 GMT</pubDate>
    <dc:creator>Anil_Babu_Samineni</dc:creator>
    <dc:date>2018-12-08T00:26:46Z</dc:date>
    <item>
      <title>Script issue setting variable:  Server update vs manual update</title>
      <link>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1518182#M437222</link>
      <description>&lt;P&gt;My client's calendar script sets the fiscal year as a variable.&amp;nbsp; Every year November, it calculates the current fiscal year from the invoice date and sets the variable.&amp;nbsp; We have Qlikview Business Server and it updates the application daily.&lt;/P&gt;&lt;P&gt;Last year when the Fiscal year changed from 2017-2018, the application updated the variable correctly - overnight server update&lt;/P&gt;&lt;P&gt;This year, when running the server update process the variable does not set.&amp;nbsp; We ran the server update on the schedule and manually and the variable stayed the same.&lt;/P&gt;&lt;P&gt;We then loaded the application and ran a "manual" update and the variable changed to the current fiscal year.&lt;/P&gt;&lt;P&gt;The problem is why did the variable update one year when the server ran the update but this year it took a manual update to trigger the change?&lt;/P&gt;&lt;P&gt;Calendar SCRIPT - Fiscal year section in blue&lt;/P&gt;&lt;P&gt;///$tab Calendar&lt;BR /&gt;SET vDefBegFisYr=2007;&lt;/P&gt;&lt;P&gt;TEMP:&lt;BR /&gt;LOAD&lt;BR /&gt;num(min(Date_InvoiceDate)) AS MinDate,&lt;BR /&gt;num(max(Date_InvoiceDate)) AS MaxDate,&lt;BR /&gt;num(max(Date_ProcDate)) AS ProcessDate&lt;BR /&gt;RESIDENT&lt;BR /&gt;FACT_OrderHeader;&lt;/P&gt;&lt;P&gt;LET vMinDate = peek('MinDate', 0, 'TEMP');&lt;BR /&gt;LET vMaxDate = peek('MaxDate', 0, 'TEMP');&lt;BR /&gt;LET iDateBeg = peek('MinDate', 0, 'TEMP');&lt;BR /&gt;LET iDateEnd = peek('MaxDate', 0, 'TEMP');&lt;BR /&gt;LET vProcessDate = peek('ProcessDate', 0, 'TEMP');&lt;/P&gt;&lt;P&gt;DROP TABLE TEMP;&lt;/P&gt;&lt;P&gt;DateIsland:&lt;BR /&gt;LOAD&lt;BR /&gt;date($(vMinDate) + rowno() - 1) AS D,&lt;BR /&gt;year($(vMinDate) + rowno() - 1) AS Y,&lt;BR /&gt;month($(vMinDate) + rowno() - 1) AS M,&lt;BR /&gt;date(monthstart($(vMinDate) + rowno() - 1), 'MMM-YYYY') AS MY&lt;BR /&gt;AUTOGENERATE&lt;BR /&gt;vMaxDate - vMinDate + 1;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;LET vInvDate =$(vMaxDate);&lt;/P&gt;&lt;P&gt;LET vToday = $(vProcessDate);&lt;BR /&gt;LET vDate_Today=Date($(vToday));&lt;BR /&gt;LET vSelectedDay = $(vProcessDate);&lt;BR /&gt;LET vDate_Selected=Date($(vSelectedDay));&lt;/P&gt;&lt;P&gt;/&lt;FONT color="#0000FF"&gt;/ FISCAL Month/Year&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;LET vCurFisMo=num(month(AddMonths(MonthsName(1,$(vInvDate),0,11),-10)),'#0');&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;LET vCurFisYr=num(Year(AddMonths(MonthsName(1,$(vInvDate),0,11),+2)),'#0');&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;LET vLastFisMo=$(vCurFisMo)-1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;LET vLastFisYr=$(vCurFisYr)-1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;//num(month($(vInvDate)));&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;LET vThisYear = year($(vInvDate));&lt;BR /&gt;LET vLastYear = year($(vInvDate)) - 1;&lt;/P&gt;&lt;P&gt;LET vThisMonthText = month($(vInvDate));&lt;BR /&gt;LET vLastMonth = num(month(addmonths($(vInvDate), -1)));&lt;BR /&gt;LET vLastMonthText = month(addmonths($(vInvDate), -1));&lt;BR /&gt;LET vTodayWithinYear = num($(vInvDate) - yearstart($(vInvDate))) + 1;&lt;BR /&gt;LET vTodayWithinMonth = num($(vInvDate) - monthstart($(vInvDate))) + 1;&lt;/P&gt;&lt;P&gt;//LET vPriorYearDate = '=date(addyears(max(Date_ProcDate),-1),' &amp;amp; chr(39) &amp;amp; 'M/DD/YYYY' &amp;amp; chr(39) &amp;amp; ')';&lt;BR /&gt;LET vPriorYearDate = AddYears($(vProcessDate),-1);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Calendar:&lt;BR /&gt;LOAD&lt;BR /&gt;D AS Link_Date,&lt;BR /&gt;D AS Date,&lt;BR /&gt;D AS Link_Daily, //links Daily Sales Reports&lt;BR /&gt;D AS LINK_WA_Date, //links Warehouse Activity&lt;BR /&gt;// D AS LINK_AP_Date, //links AP Activity&lt;BR /&gt;// D AS LINK_AR_Date, //links AR Activity&lt;BR /&gt;// D AS LINK_INV_Date,//links On Hand INV Calendar&lt;/P&gt;&lt;P&gt;// Basic Date Dimensions&lt;BR /&gt;Y AS Year,&lt;BR /&gt;M AS Month,&lt;BR /&gt;MY AS MonthYear,&lt;BR /&gt;num(MY) AS NumericMonthYear,&lt;BR /&gt;'Q' &amp;amp; ceil(M / 3) AS Quarter,&lt;BR /&gt;week(D) AS Week,&lt;BR /&gt;weekday(D) AS Weekday,&lt;BR /&gt;day(D) AS Day,&lt;BR /&gt;&lt;BR /&gt;//Fiscal Dates&lt;BR /&gt;'Q' &amp;amp; Ceil(month(AddMonths(MonthsName(3,D,0,11),-10))/3) as FisQuarter,&lt;BR /&gt;num(month(AddMonths(MonthsName(1,D,0,11),-10)),'#0') as FisMo,&lt;BR /&gt;num(Year(AddMonths(MonthsName(1,D,0,11),+2)),'#0') as FisYr,&lt;BR /&gt;month(D) as FisMoShort,&lt;/P&gt;&lt;P&gt;// Flags for determining time periods&lt;BR /&gt;inyear(D, $(vInvDate), 0) * -1 AS CAL_CurrentYear, //Current year&lt;BR /&gt;inyeartodate(D, $(vInvDate), 0) * -1 AS CAL_CurrentYTD, //Current year-to-date&lt;BR /&gt;inquarter(D, $(vInvDate), 0) * -1 AS CAL_CurrentQtr, //Current qua&lt;BR /&gt;inmonth(D, $(vInvDate), 0) * -1 AS CAL_CurrentMonth, //Current month&lt;BR /&gt;inmonth(D, $(vInvDate), -1) * -1 AS CAL_LaStMonth, //Previous month&lt;BR /&gt;inmonthtodate(D, $(vInvDate), 0) * -1 AS CAL_CurrentMTD, //Current month-to-date&lt;BR /&gt;inmonthtodate(D, $(vInvDate), -1) * -1 AS CAL_LastMonthMTD, //Previous month-to-date&lt;BR /&gt;inday(D, $(vInvDate), 0) * -1 AS CAL_CurrentDay,&lt;BR /&gt;inweek(D, $(vToday), 0) * -1 AS CAL_CurrentWeek, //Current day&lt;BR /&gt;inweek(D, $(vInvDate), -1) * -1 AS CAL_LastWeek, //One week ago&lt;BR /&gt;inweektodate(D, $(vInvDate), 0) * -1 AS CAL_CurrentWTD, //Current week-to-date&lt;BR /&gt;inweektodate(D, $(vInvDate), -1) * -1 AS CAL_LastWTD //One week ago to date&lt;BR /&gt;RESIDENT&lt;BR /&gt;DateIsland;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 22:33:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1518182#M437222</guid>
      <dc:creator>slamster44</dc:creator>
      <dc:date>2018-12-07T22:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Script issue setting variable:  Server update vs manual update</title>
      <link>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1518189#M437224</link>
      <description>&lt;P&gt;Why &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;Num(Expression, '#0')&lt;/FONT&gt;&lt;/STRONG&gt; required? Instead can't you use simply &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Num(Expression, 00)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Dec 2018 00:26:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1518189#M437224</guid>
      <dc:creator>Anil_Babu_Samineni</dc:creator>
      <dc:date>2018-12-08T00:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: Script issue setting variable:  Server update vs manual update</title>
      <link>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1518201#M437225</link>
      <description>&lt;P&gt;Honestly - I adapted the calendar script from the community so not sure how to answer that - Does it make a difference to my issue?&lt;/P&gt;</description>
      <pubDate>Sat, 08 Dec 2018 04:14:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1518201#M437225</guid>
      <dc:creator>slamster44</dc:creator>
      <dc:date>2018-12-08T04:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Script issue setting variable:  Server update vs manual update</title>
      <link>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1518241#M437229</link>
      <description>In which variable you are facing issue???&lt;BR /&gt;&lt;BR /&gt;Regards,</description>
      <pubDate>Sat, 08 Dec 2018 11:14:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1518241#M437229</guid>
      <dc:creator>PrashantSangle</dc:creator>
      <dc:date>2018-12-08T11:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: Script issue setting variable:  Server update vs manual update</title>
      <link>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1521237#M437549</link>
      <description>&lt;P&gt;&lt;SPAN&gt;LET vCurFisYr=num(Year(AddMonths(MonthsName(1,$(vInvDate),0,11),+2)),'#0');&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;last year, it updated fine from Fiscal year 2017 to 2018,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This year we had to run the script manually for it to update.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Dec 2018 20:38:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1521237#M437549</guid>
      <dc:creator>slamster44</dc:creator>
      <dc:date>2018-12-14T20:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Script issue setting variable:  Server update vs manual update</title>
      <link>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1521365#M437554</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;What is output maxdate of in below script? and value of&lt;BR /&gt;LET vMaxDate = peek('MaxDate', 0, 'TEMP');&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;TEMP:&lt;BR /&gt;LOAD&lt;BR /&gt;num(min(Date_InvoiceDate)) AS MinDate,&lt;BR /&gt;num(max(Date_InvoiceDate)) AS MaxDate,&lt;BR /&gt;num(max(Date_ProcDate)) AS ProcessDate&lt;BR /&gt;RESIDENT&lt;BR /&gt;FACT_OrderHeader;</description>
      <pubDate>Mon, 17 Dec 2018 03:52:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1521365#M437554</guid>
      <dc:creator>PrashantSangle</dc:creator>
      <dc:date>2018-12-17T03:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Script issue setting variable:  Server update vs manual update</title>
      <link>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1522333#M437624</link>
      <description>&lt;P&gt;it is either the numerical date which i then convert using DATE(vMaxDate)&lt;/P&gt;&lt;P&gt;or it is the actual Max date of the invoice.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When it sees 11/6/2018 as the vMaxDate&amp;nbsp;it should recognize it is the new fiscal year and set vCurFisYr to 2019.&lt;/P&gt;&lt;P&gt;Last year it rolled over fine, this year it did not until we manually ran the script.&amp;nbsp; I am thinking this is more a bug issue versus a variable setting issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately, right now I do not have access to the application for testing.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Dec 2018 20:49:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-issue-setting-variable-Server-update-vs-manual-update/m-p/1522333#M437624</guid>
      <dc:creator>slamster44</dc:creator>
      <dc:date>2018-12-18T20:49:29Z</dc:date>
    </item>
  </channel>
</rss>

