<?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: Variable in Script - Assign Value based on If Statement in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427769#M612295</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It will not work like that. The variable inside that Pick how that is changing? What is the expression of vCurrentPeriod variable. Need to write a loop statement i believe for this. Can you share some sample data? I can look into this tomorrow. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vish.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Oct 2017 02:31:25 GMT</pubDate>
    <dc:creator>vishsaggi</dc:creator>
    <dc:date>2017-10-25T02:31:25Z</dc:date>
    <item>
      <title>Variable in Script - Assign Value based on If Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427760#M612286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm hoping this is an easy question, but i've never created variables in my script before so just after some help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an average sales calculation in one of my reports that requires a dynamic value as part of the formula.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This value needs to change depending on the current Financial Period (Period 1-12 which represent Months)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's name this changing value "vSalesAverageCalc"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a variable that has been created in the past, which picks up the current Financial Period (vReportCurrent_Period)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need in my script is the following logical statement: (rough idea - I know this incorrect syntax)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If vReportCurrent_Period is 1,2 or 3, Let vSalesAverageCalc = 24&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;If vReportCurrent_Period is 4,5 or 6 Let vSalesAverageCalc = 15&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;If vReportCurrent_Period is 7,8 or 9 Let vSalesAverageCalc = 18&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;If vReportCurrent_Period is 10,11 or 12 Let vSalesAverageCalc = 21&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;is someone able to help me with this syntax for this variable?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;and should the variable already exist in the .qvw or is it created dynamically when the script runs?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Thanks in advance everybody!!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Cheers - Fab&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 00:00:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427760#M612286</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-25T00:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Script - Assign Value based on If Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427761#M612287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be try this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Click Ctrl+Alt+V -&amp;gt; It will open variable overview window just add a variable give the name vSalesAverageCalc -&amp;gt; Then add this expr:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;= Pick(YourCurrentReportPeriodVariable, 24, 24, 24, 15, 15, 15, 18, 18, 18, 21, 21, 21)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 01:48:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427761#M612287</guid>
      <dc:creator>vishsaggi</dc:creator>
      <dc:date>2017-10-25T01:48:23Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Script - Assign Value based on If Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427762#M612288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your input Vishwarath,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that's a great option - haven't done much with variables as yet...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how can I find out what resultant numerical value has been assigned to &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt; vSalesAverageCalc?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 01:59:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427762#M612288</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-25T01:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Script - Assign Value based on If Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427763#M612289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm also trying to divide a previously loaded dimension by the new variable but it gives me a " requires ')' " error...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I call a variable in a divide by statement like below?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ISHRB12WeekAverageQtySales:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;ISHRBSKU,&lt;/P&gt;&lt;P&gt;(ISHRB12WeekAvgQTYSales_temp / '$(v12WeekAverageCalc)') as ISHRB12WeekAvgQTYSales&lt;/P&gt;&lt;P&gt;Resident ISHRB12WeekAverageQtySales_temp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers - Fab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 02:04:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427763#M612289</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-25T02:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Script - Assign Value based on If Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427764#M612290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create a textbox and add your vSalesAverageCalc variable like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;= vSalesAverageCalc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on your current period selection the value changes. &lt;/P&gt;&lt;P&gt;Where exactly you want to use this variable i mean in a chart?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 02:05:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427764#M612290</guid>
      <dc:creator>vishsaggi</dc:creator>
      <dc:date>2017-10-25T02:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Script - Assign Value based on If Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427765#M612291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you show how you defining your variable and screenshot of your error?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 02:07:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427765#M612291</guid>
      <dc:creator>vishsaggi</dc:creator>
      <dc:date>2017-10-25T02:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Script - Assign Value based on If Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427766#M612292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That works well Thanks!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;correct Value... we are currently in Period 4 so the result is 15...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will post some screen shots shortly re the dividing by the variable issue..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help, really appreciate it...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 02:11:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427766#M612292</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-25T02:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Script - Assign Value based on If Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427767#M612293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here's my script for that section:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ISHRB12WeekAverageQtySales:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;ISHRBSKU,&lt;/P&gt;&lt;P&gt;(ISHRB12WeekAvgQTYSales_temp / $(v12WeekAverageCalc)) as ISHRB12WeekAvgQTYSales&lt;/P&gt;&lt;P&gt;Resident ISHRB12WeekAverageQtySales_temp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to display &lt;SPAN style="font-size: 13.3333px;"&gt;ISHRB12WeekAvgQTYSales in my pivot chart.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;ISHRB12WeekAvgQTYSales_temp is previously loaded in the cript and works fine, I have to divide it by the value of variable &lt;SPAN style="font-size: 13.3333px;"&gt;v12WeekAverageCalc which you have helped me define above...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;I am getting this error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;IMG alt="variable script error.jpg" class="jive-image image-1" src="/legacyfs/online/180810_variable script error.jpg" style="height: 185px; width: 620px;" /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 02:20:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427767#M612293</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-25T02:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Script - Assign Value based on If Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427768#M612294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if you need to take a look at this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="variable settings.JPG" class="jive-image image-1" src="/legacyfs/online/180811_variable settings.JPG" style="height: 543px; width: 620px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 02:31:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427768#M612294</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-25T02:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Script - Assign Value based on If Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427769#M612295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It will not work like that. The variable inside that Pick how that is changing? What is the expression of vCurrentPeriod variable. Need to write a loop statement i believe for this. Can you share some sample data? I can look into this tomorrow. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vish.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 02:31:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427769#M612295</guid>
      <dc:creator>vishsaggi</dc:creator>
      <dc:date>2017-10-25T02:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Script - Assign Value based on If Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427770#M612296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Vish I appreciate that...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you have answered the original question so I will close this thread and mark it as answered...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will open a new question about this one...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 02:40:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427770#M612296</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-25T02:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Script - Assign Value based on If Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427771#M612297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No problem. And can you post a sample app or guide me to the new post you created. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 14:47:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427771#M612297</guid>
      <dc:creator>vishsaggi</dc:creator>
      <dc:date>2017-10-25T14:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in Script - Assign Value based on If Statement</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427772#M612298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your interest...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here's the new post regarding my issue dividing by the resultant of that variable you help me define.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/message/1368248"&gt;Divide dimension by Variable in a script&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to share a sample QVW, but my script refers to my ODBC database... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to create a sample QVW and include some of my data within the qvw instead of trying to pull it down from a database via ODBC?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fab&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Oct 2017 22:14:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-Script-Assign-Value-based-on-If-Statement/m-p/1427772#M612298</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-10-25T22:14:12Z</dc:date>
    </item>
  </channel>
</rss>

