<?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: Variables loaded from Excel file in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Variables-loaded-from-Excel-file/m-p/2501065#M103271</link>
    <description>&lt;P&gt;You have an error in your script. You should be PEEKing the variable value directly to avoid the Dollar Sign Expansion (DSE). Like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;FOR var_i = 1 TO NoOfRows('Variables')

     l_var = PEEK('Name', var_i - 1, 'Variables');

     Let $(l_var) = PEEK('Value', var_i  - 1, 'Variables');

NEXT var_i;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jan 2025 16:32:32 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2025-01-13T16:32:32Z</dc:date>
    <item>
      <title>Variables loaded from Excel file</title>
      <link>https://community.qlik.com/t5/App-Development/Variables-loaded-from-Excel-file/m-p/2500843#M103231</link>
      <description>&lt;P&gt;Hi, I'm trying to load 2 variables from an Excel file, and use the first one in the set analysis of the second one.&lt;BR /&gt;Here are the variables:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;vDateRange&lt;/TD&gt;
&lt;TD width="50%"&gt;if(vSwitch=1,&lt;BR /&gt;'&amp;gt;='&amp;amp;monthstart(addmonths(min(YearMonth),-2))&amp;amp;'&amp;lt;='&amp;amp; monthend(addmonths(max(YearMonth),-1)),&lt;BR /&gt;'&amp;gt;='&amp;amp;monthstart(addyears(min(YearMonth),-2))&amp;amp;'&amp;lt;='&amp;amp; monthend(addyears(max(YearMonth),-1)))&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;vExpression&lt;/TD&gt;
&lt;TD width="50%"&gt;sum({&amp;lt;[Date]={"$(=vDateRange)"}&amp;gt;}[Amount])&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried every possible combination of dollar and equal signs in both variables but i can't get it to work.&lt;/P&gt;
&lt;P&gt;In the app, when using "vExpression" in a measure i get 0 as result. The preview of the formula shows me:&lt;/P&gt;
&lt;P&gt;sum({&amp;lt;[Date]={"if(vSwitch=1,&lt;BR /&gt;'&amp;gt;='&amp;amp;monthstart(addmonths(min(YearMonth),-2))&amp;amp;'&amp;lt;='&amp;amp; monthend(addmonths(max(YearMonth),+1)),&lt;BR /&gt;'&amp;gt;='&amp;amp;monthstart(addyears(min(YearMonth),-2))&amp;amp;'&amp;lt;='&amp;amp; monthend(addyears(max(YearMonth),+1)))"}&amp;gt;}[Amount])&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;sum({&amp;lt;[Date]={}&amp;gt;}[Amount])&lt;/P&gt;
&lt;P&gt;depending on the combination of $ and = used.&lt;/P&gt;
&lt;P&gt;When I tried to load the same vExpression from the variable panel it's working properly, but not when loaded from the Excel file.&lt;/P&gt;
&lt;P&gt;I want the&amp;nbsp;vDateRange variable in the set analysis to be evaluated, but it has to be evaluated at a chart level, not when the app is being loaded.&lt;/P&gt;
&lt;P&gt;e.g&amp;nbsp;sum({&amp;lt;[Date]={"&amp;gt;=01/11/2024&amp;lt;=31/12/2024"}&amp;gt;}[Amount])&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot for your help&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 15:16:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Variables-loaded-from-Excel-file/m-p/2500843#M103231</guid>
      <dc:creator>gfaccenda</dc:creator>
      <dc:date>2025-01-10T15:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Variables loaded from Excel file</title>
      <link>https://community.qlik.com/t5/App-Development/Variables-loaded-from-Excel-file/m-p/2500870#M103238</link>
      <description>&lt;P&gt;Can you post the script you are using to load the variables from Excel?&lt;/P&gt;
&lt;P&gt;-Rob&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2025 17:38:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Variables-loaded-from-Excel-file/m-p/2500870#M103238</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2025-01-10T17:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Variables loaded from Excel file</title>
      <link>https://community.qlik.com/t5/App-Development/Variables-loaded-from-Excel-file/m-p/2500978#M103254</link>
      <description>&lt;P&gt;Hi Rob,&lt;BR /&gt;The script is the following:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Variables:
LOAD
    Name,
    Value
FROM [lib://PATH/Variables.xlsx]
(ooxml, embedded labels, table is Sheet1);

FOR var_i = 1 TO NoOfRows('Variables')

     l_var = PEEK('Name', var_i - 1, 'Variables');

     l_val = PEEK('Value', var_i  - 1, 'Variables');

     SET $(l_var) = $(l_val);

NEXT var_i;

Let var_i =;
Let l_val =;
Let l_var =;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 13 Jan 2025 08:46:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Variables-loaded-from-Excel-file/m-p/2500978#M103254</guid>
      <dc:creator>gfaccenda</dc:creator>
      <dc:date>2025-01-13T08:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: Variables loaded from Excel file</title>
      <link>https://community.qlik.com/t5/App-Development/Variables-loaded-from-Excel-file/m-p/2501058#M103270</link>
      <description>&lt;P&gt;You may try:&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;vDateRange&lt;/TD&gt;
&lt;TD width="50%"&gt;if(vSwitch=1,&lt;BR /&gt;'&amp;gt;=monthstart(addmonths(min(YearMonth),-2))&amp;lt;= monthend(addmonths(max(YearMonth),-1))',&lt;BR /&gt;'&amp;gt;=monthstart(addyears(min(YearMonth),-2))&amp;lt;= monthend(addyears(max(YearMonth),-1))')&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%"&gt;vExpression&lt;/TD&gt;
&lt;TD width="50%"&gt;sum({&amp;lt;[Date]={"$(=$(vDateRange))"}&amp;gt;}[Amount])&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2025 15:45:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Variables-loaded-from-Excel-file/m-p/2501058#M103270</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2025-01-13T15:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Variables loaded from Excel file</title>
      <link>https://community.qlik.com/t5/App-Development/Variables-loaded-from-Excel-file/m-p/2501065#M103271</link>
      <description>&lt;P&gt;You have an error in your script. You should be PEEKing the variable value directly to avoid the Dollar Sign Expansion (DSE). Like this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;FOR var_i = 1 TO NoOfRows('Variables')

     l_var = PEEK('Name', var_i - 1, 'Variables');

     Let $(l_var) = PEEK('Value', var_i  - 1, 'Variables');

NEXT var_i;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2025 16:32:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Variables-loaded-from-Excel-file/m-p/2501065#M103271</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2025-01-13T16:32:32Z</dc:date>
    </item>
  </channel>
</rss>

