<?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 Using a variable as a global expression and putting it outside QV applications in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Using-a-variable-as-a-global-expression-and-putting-it-outside/m-p/274720#M708108</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a solution that - as I see it - is pretty neat. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a lot of applications I present the same KPI's. I build it so that I make a QVD file containing all relevant metrics (for instance no. calls, total handling times, etc.). I load these into different applications, and in different objects I calculate the KPI's based on the metrics. That is, I have defined what expressions that are used in which calculations, and by a long if statement, I ask QlikView to calculate the KPI values distributed on different dimensions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works really good, but for the ease of it, I put the long if statement into a variable and then calls this in the objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is, whether anyone knows whether or not you can put this variable into the load script of the applications. I am think using something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET Value = .... (if statement). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the thing is that it contains a lot of ' and so one that the load script misinterpret. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I am think - also to have only one place to maitain this if statement - to put the if statement into a type of include file... (qv script file .qvs).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But does anyone know how to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, how do I make the script of the 'if' statement so that QlikView automatically loads the if statement as a variable in the aplications including the include file (.qvs)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Dec 2011 13:13:25 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-12-02T13:13:25Z</dc:date>
    <item>
      <title>Using a variable as a global expression and putting it outside QV applications</title>
      <link>https://community.qlik.com/t5/QlikView/Using-a-variable-as-a-global-expression-and-putting-it-outside/m-p/274720#M708108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a solution that - as I see it - is pretty neat. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a lot of applications I present the same KPI's. I build it so that I make a QVD file containing all relevant metrics (for instance no. calls, total handling times, etc.). I load these into different applications, and in different objects I calculate the KPI's based on the metrics. That is, I have defined what expressions that are used in which calculations, and by a long if statement, I ask QlikView to calculate the KPI values distributed on different dimensions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works really good, but for the ease of it, I put the long if statement into a variable and then calls this in the objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is, whether anyone knows whether or not you can put this variable into the load script of the applications. I am think using something like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET Value = .... (if statement). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the thing is that it contains a lot of ' and so one that the load script misinterpret. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I am think - also to have only one place to maitain this if statement - to put the if statement into a type of include file... (qv script file .qvs).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But does anyone know how to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, how do I make the script of the 'if' statement so that QlikView automatically loads the if statement as a variable in the aplications including the include file (.qvs)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Dec 2011 13:13:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-a-variable-as-a-global-expression-and-putting-it-outside/m-p/274720#M708108</guid>
      <dc:creator />
      <dc:date>2011-12-02T13:13:25Z</dc:date>
    </item>
    <item>
      <title>Using a variable as a global expression and putting it outside QV applications</title>
      <link>https://community.qlik.com/t5/QlikView/Using-a-variable-as-a-global-expression-and-putting-it-outside/m-p/274721#M708109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Save you variable script in a file and save it with QVS extension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And then in Edit Script -&amp;gt; Edit tab -&amp;gt; Include and select your QVS file, then you will get something like &lt;/P&gt;&lt;P&gt;$(Include=filename.qvs).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This loads your variable every time you load QVW file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Dec 2011 13:53:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-a-variable-as-a-global-expression-and-putting-it-outside/m-p/274721#M708109</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2011-12-02T13:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using a variable as a global expression and putting it outside QV applications</title>
      <link>https://community.qlik.com/t5/QlikView/Using-a-variable-as-a-global-expression-and-putting-it-outside/m-p/274722#M708110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, but it doesn't work as I want it...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance, if I have a variable that looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(KPI = 'Abandoned rate'&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;SUM(&lt;/P&gt;&lt;P&gt;{&amp;lt;&lt;/P&gt;&lt;P&gt;Metric = {'Abandoned contacts'}&lt;/P&gt;&lt;P&gt;&amp;gt;}&lt;/P&gt;&lt;P&gt;Value )&lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;SUM(&lt;/P&gt;&lt;P&gt;{&amp;lt;&lt;/P&gt;&lt;P&gt;Metric = {'Offered contacts (calls)'}&lt;/P&gt;&lt;P&gt;&amp;gt;}&lt;/P&gt;&lt;P&gt;Value )&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;if(KPI = 'Monitorering - antal'&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;SUM(&lt;/P&gt;&lt;P&gt;{&amp;lt;&lt;/P&gt;&lt;P&gt;Metric = {'Monitoring - total'}&lt;/P&gt;&lt;P&gt;&amp;gt;}&lt;/P&gt;&lt;P&gt;Value )&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;if(KPI = 'Monitorering - bestået'&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;SUM(&lt;/P&gt;&lt;P&gt;{&amp;lt;&lt;/P&gt;&lt;P&gt;Metric = {'Monitoring - passed'}&lt;/P&gt;&lt;P&gt;&amp;gt;}&lt;/P&gt;&lt;P&gt;Value )&lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;SUM(&lt;/P&gt;&lt;P&gt;{&amp;lt;&lt;/P&gt;&lt;P&gt;Metric = {'Monitoring - total'}&lt;/P&gt;&lt;P&gt;&amp;gt;}&lt;/P&gt;&lt;P&gt;Value )&lt;/P&gt;&lt;P&gt;)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I want this to be in a variable of my QV document. How should I script this in a .qvs file in order for the LET XX = $(Include=XXXX.qvs) to work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/Kim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Dec 2011 12:36:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-a-variable-as-a-global-expression-and-putting-it-outside/m-p/274722#M708110</guid>
      <dc:creator />
      <dc:date>2011-12-13T12:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using a variable as a global expression and putting it outside QV applications</title>
      <link>https://community.qlik.com/t5/QlikView/Using-a-variable-as-a-global-expression-and-putting-it-outside/m-p/274723#M708111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of LET use SET, just pasted this in text file and save with QVS extension.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET vTemp = if(KPI = 'Abandoned rate',&lt;/P&gt;&lt;P&gt;SUM(&lt;/P&gt;&lt;P&gt;{&amp;lt;&lt;/P&gt;&lt;P&gt;Metric = {'Abandoned contacts'}&lt;/P&gt;&lt;P&gt;&amp;gt;}&lt;/P&gt;&lt;P&gt;Value )&lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;SUM(&lt;/P&gt;&lt;P&gt;{&amp;lt;&lt;/P&gt;&lt;P&gt;Metric = {'Offered contacts (calls)'}&lt;/P&gt;&lt;P&gt;&amp;gt;}&lt;/P&gt;&lt;P&gt;Value )&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;if(KPI = 'Monitorering - antal'&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;SUM(&lt;/P&gt;&lt;P&gt;{&amp;lt;&lt;/P&gt;&lt;P&gt;Metric = {'Monitoring - total'}&lt;/P&gt;&lt;P&gt;&amp;gt;}&lt;/P&gt;&lt;P&gt;Value )&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;if(KPI = 'Monitorering - bestået'&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;SUM(&lt;/P&gt;&lt;P&gt;{&amp;lt;&lt;/P&gt;&lt;P&gt;Metric = {'Monitoring - passed'}&lt;/P&gt;&lt;P&gt;&amp;gt;}&lt;/P&gt;&lt;P&gt;Value )&lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;SUM(&lt;/P&gt;&lt;P&gt;{&amp;lt;&lt;/P&gt;&lt;P&gt;Metric = {'Monitoring - total'}&lt;/P&gt;&lt;P&gt;&amp;gt;}&lt;/P&gt;&lt;P&gt;Value )&lt;/P&gt;&lt;P&gt;))) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And use =$(vTemp) as an expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jagan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Dec 2011 13:23:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-a-variable-as-a-global-expression-and-putting-it-outside/m-p/274723#M708111</guid>
      <dc:creator>jagan</dc:creator>
      <dc:date>2011-12-13T13:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using a variable as a global expression and putting it outside QV applications</title>
      <link>https://community.qlik.com/t5/QlikView/Using-a-variable-as-a-global-expression-and-putting-it-outside/m-p/274724#M708112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Yes, I found out... &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/grin.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, it works like a charm!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/Kim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Dec 2011 13:26:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Using-a-variable-as-a-global-expression-and-putting-it-outside/m-p/274724#M708112</guid>
      <dc:creator />
      <dc:date>2011-12-13T13:26:51Z</dc:date>
    </item>
  </channel>
</rss>

