<?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 Formula with Variable Stored in Variable in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Formula-with-Variable-Stored-in-Variable/m-p/1299949#M405287</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a bunch of calculations/formulas stored as variables in an application.&amp;nbsp; I am trying to move the definition of these variables to a QVS file for easier maintenance.&amp;nbsp; However I am running into problems when the formula includes a reference to a variable, these variables are getting evaluated and 'removed' from the formula because the variable as not value at the time the script is run as it is set interactively in the application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Variable definition as defined directly in the application, two variables are referenced vPer1Min &amp;amp; vPer1Max&lt;UL&gt;&lt;LI&gt;Sum({$&amp;lt;[c_Invoice Type]={'NORMAL'},%dtl_date_key=&lt;STRONG style="color: #ff0000;"&gt;{"&amp;gt;=$(=vPer1Min)&amp;lt;=$(=vPer1Max)"}&lt;/STRONG&gt;&amp;gt;} [Item Net Sales (USD)]&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Variable definition in QVS file&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Method 1 - Using Set:&lt;/STRONG&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Script Line:&lt;/STRONG&gt; Set fInvPer1SumUSD = 'Sum({$&amp;lt;[c_Invoice Type]={''NORMAL''},%dtl_date_key={"&amp;gt;=$(=vPer1Min)&amp;lt;=$(=vPer1Max)"}&amp;gt;} [Item Net Sales (USD)])';&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Definition after script run: &lt;/STRONG&gt;Sum({$&amp;lt;[c_Invoice Type]={'NORMAL'},%dtl_date_key=&lt;STRONG style="color: #ff0000;"&gt;{"&amp;gt;=&amp;lt;="}&lt;/STRONG&gt;&amp;gt;} [Item Net Sales (USD)])&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG style="font-size: 10pt;"&gt;Method 2 - Using Let:&lt;/STRONG&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG style="font-size: 10pt;"&gt;Script Line: &lt;/STRONG&gt;Let fInvPer1SumUSD = 'Sum({$&amp;lt;[c_Invoice Type]={''NORMAL''},%dtl_date_key={"&amp;gt;=$(=vPer1Min)&amp;lt;=$(=vPer1Max)"}&amp;gt;} [Item Net Sales (USD)])';&lt;/LI&gt;&lt;LI&gt;&lt;STRONG style="font-size: 10pt;"&gt;Definition after script run: &lt;/STRONG&gt;Sum({$&amp;lt;[c_Invoice Type]={'NORMAL'},%dtl_date_key=&lt;STRONG style="color: #ff0000;"&gt;{"&amp;gt;=&amp;lt;="}&lt;/STRONG&gt;&amp;gt;} [Item Net Sales (USD)])&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do I need to add to the script line so that the variable vPer1Min and vPer1Max are not evaluated when the script is run?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Jun 2017 18:11:56 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-06-15T18:11:56Z</dc:date>
    <item>
      <title>Formula with Variable Stored in Variable</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-with-Variable-Stored-in-Variable/m-p/1299949#M405287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a bunch of calculations/formulas stored as variables in an application.&amp;nbsp; I am trying to move the definition of these variables to a QVS file for easier maintenance.&amp;nbsp; However I am running into problems when the formula includes a reference to a variable, these variables are getting evaluated and 'removed' from the formula because the variable as not value at the time the script is run as it is set interactively in the application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Variable definition as defined directly in the application, two variables are referenced vPer1Min &amp;amp; vPer1Max&lt;UL&gt;&lt;LI&gt;Sum({$&amp;lt;[c_Invoice Type]={'NORMAL'},%dtl_date_key=&lt;STRONG style="color: #ff0000;"&gt;{"&amp;gt;=$(=vPer1Min)&amp;lt;=$(=vPer1Max)"}&lt;/STRONG&gt;&amp;gt;} [Item Net Sales (USD)]&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Variable definition in QVS file&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Method 1 - Using Set:&lt;/STRONG&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;Script Line:&lt;/STRONG&gt; Set fInvPer1SumUSD = 'Sum({$&amp;lt;[c_Invoice Type]={''NORMAL''},%dtl_date_key={"&amp;gt;=$(=vPer1Min)&amp;lt;=$(=vPer1Max)"}&amp;gt;} [Item Net Sales (USD)])';&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Definition after script run: &lt;/STRONG&gt;Sum({$&amp;lt;[c_Invoice Type]={'NORMAL'},%dtl_date_key=&lt;STRONG style="color: #ff0000;"&gt;{"&amp;gt;=&amp;lt;="}&lt;/STRONG&gt;&amp;gt;} [Item Net Sales (USD)])&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG style="font-size: 10pt;"&gt;Method 2 - Using Let:&lt;/STRONG&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG style="font-size: 10pt;"&gt;Script Line: &lt;/STRONG&gt;Let fInvPer1SumUSD = 'Sum({$&amp;lt;[c_Invoice Type]={''NORMAL''},%dtl_date_key={"&amp;gt;=$(=vPer1Min)&amp;lt;=$(=vPer1Max)"}&amp;gt;} [Item Net Sales (USD)])';&lt;/LI&gt;&lt;LI&gt;&lt;STRONG style="font-size: 10pt;"&gt;Definition after script run: &lt;/STRONG&gt;Sum({$&amp;lt;[c_Invoice Type]={'NORMAL'},%dtl_date_key=&lt;STRONG style="color: #ff0000;"&gt;{"&amp;gt;=&amp;lt;="}&lt;/STRONG&gt;&amp;gt;} [Item Net Sales (USD)])&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What do I need to add to the script line so that the variable vPer1Min and vPer1Max are not evaluated when the script is run?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jun 2017 18:11:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-with-Variable-Stored-in-Variable/m-p/1299949#M405287</guid>
      <dc:creator />
      <dc:date>2017-06-15T18:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Formula with Variable Stored in Variable</title>
      <link>https://community.qlik.com/t5/QlikView/Formula-with-Variable-Stored-in-Variable/m-p/1299950#M405288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Jessica, w&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;hen script founds &lt;EM&gt;$(&lt;/EM&gt; it tries to evaluate, one way to avoid this is using another character and Replace():&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;Let fInvPer1SumUSD = Replace('Sum({$&amp;lt;[c_Invoice Type]={''NORMAL''},%dtl_date_key={"&amp;gt;=#(=vPer1Min)&amp;lt;=#(=vPer1Max)"}&amp;gt;} [Item Net Sales (USD)])', '#', '$');&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;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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jun 2017 18:22:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Formula-with-Variable-Stored-in-Variable/m-p/1299950#M405288</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2017-06-15T18:22:42Z</dc:date>
    </item>
  </channel>
</rss>

