<?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: Only() and Expressions in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881322#M307526</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It certainly is less complex...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Jun 2015 11:27:21 GMT</pubDate>
    <dc:creator>Peter_Cammaert</dc:creator>
    <dc:date>2015-06-23T11:27:21Z</dc:date>
    <item>
      <title>Only() and Expressions as Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881318#M307522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;Good morning delightful people&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;I have two QVWs that differ slightly; they do need to be two separate QVWs.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;I was trying to so a little future proofing and thought I would centralise all expression in a sort of config. file. This would mean I would only have to update the expression once. I was wondering the best way to do it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;For example:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLENAME:&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="112" style="border: 1px solid #000000; border-image: none; width: 365px; height: 114px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;ChartID&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Expression&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;Variable&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;CH01&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;=Sum(Sales)&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;vSales&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;CH02&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;=Count(Orders)&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;vOrders&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;CH02&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;=Count(DISTINCT SalesPerson)&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;vSPerson&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333;"&gt;One route was to use a loop and create a variable to create a variable for every row:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt;"&gt;&lt;STRONG&gt;LET&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;SPAN style="; color: #808080;"&gt;&lt;EM&gt;nRows&lt;/EM&gt;&lt;/SPAN&gt; = &lt;SPAN style="color: #0000ff;"&gt;NoOfRows&lt;/SPAN&gt;(TABLENAME);&lt;BR /&gt;&lt;SPAN style="; color: #0000ff;"&gt;&lt;STRONG&gt;FOR&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="; color: #808080;"&gt;&lt;EM&gt;i&lt;/EM&gt;&lt;/SPAN&gt; = 0 &lt;SPAN style="color: #0000ff;"&gt;to&lt;/SPAN&gt; &lt;SPAN style="; color: #808080;"&gt;&lt;EM&gt;$(nRows)&lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="; color: #0000ff;"&gt;&lt;STRONG&gt;LET &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="; color: #808080;"&gt;&lt;EM&gt;vVariable&lt;/EM&gt;&lt;/SPAN&gt; = &lt;SPAN style="color: #0000ff;"&gt;Peek&lt;/SPAN&gt;(&lt;STRONG&gt;Variable&lt;/STRONG&gt;,&lt;SPAN style="; color: #808080;"&gt;&lt;EM&gt;$(i)&lt;/EM&gt;&lt;/SPAN&gt;);&lt;BR /&gt;&lt;SPAN style="; color: #0000ff;"&gt;&lt;STRONG&gt;LET&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="; color: #808080;"&gt;&lt;EM&gt;$(vVariable)&lt;/EM&gt;&lt;/SPAN&gt; = &lt;SPAN style="color: #0000ff;"&gt;Peek&lt;/SPAN&gt;('&lt;STRONG&gt;Expression&lt;/STRONG&gt;',&lt;SPAN style="; color: #808080;"&gt;&lt;EM&gt;$(i)&lt;/EM&gt;&lt;/SPAN&gt;);&lt;BR /&gt;&lt;SPAN style="; color: #0000ff;"&gt;&lt;STRONG&gt;NEXT&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;EM&gt;i&lt;/EM&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 10pt;"&gt;This works fine if I remove the leading "=", but it's very messy; creating 400+ variables.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 10pt;"&gt;I'd rather create a table in the data model and do something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #0000ff;"&gt;Only&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;({&amp;lt;&lt;SPAN style="color: #800000;"&gt;Variable&lt;/SPAN&gt;={'vSales'}&amp;gt;} &lt;SPAN style="color: #800000;"&gt;Expression&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 10pt;"&gt;But this method doesn't calculate the value of the expression in a chart; in brings back the text string.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;---&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Anyone have an elegant way of doing this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 10pt;"&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 11:15:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881318#M307522</guid>
      <dc:creator />
      <dc:date>2015-06-23T11:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Only() and Expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881319#M307523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try to change to $(&lt;SPAN style="font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333320617676px; font-family: inherit; color: #0000ff;"&gt;Only&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333320617676px; font-family: inherit; color: #000000;"&gt;({&amp;lt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333320617676px; font-family: inherit; color: #800000;"&gt;Variable&lt;/SPAN&gt;={'vSales'}&amp;gt;} &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333320617676px; font-family: inherit; color: #800000;"&gt;Expression&lt;/SPAN&gt;))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 11:18:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881319#M307523</guid>
      <dc:creator>lironbaram</dc:creator>
      <dc:date>2015-06-23T11:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Only() and Expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881320#M307524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You cannot dynamically change an expression in this way, as optimal techniques like $-sign substitution and set analysis are evaluated before the chart is recalculated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;QlikView has an evaluate() function that evaluates the expression as presented by the single text-parameter. unfortunately this is a script-only function. It doesn't work in chart expressions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why can't you simply use this in your chart expression field (keep the '=' character in the original data)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;$(vSales)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We do this all the time when making use of expressions that can be externally configured (in an Excel or some other file)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 11:24:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881320#M307524</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2015-06-23T11:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Only() and Expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881321#M307525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You know you've been a dummy when the question takes longer to write than the answer! &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/blush.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 11:24:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881321#M307525</guid>
      <dc:creator />
      <dc:date>2015-06-23T11:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Only() and Expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881322#M307526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It certainly is less complex...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 11:27:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881322#M307526</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2015-06-23T11:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: Only() and Expressions</title>
      <link>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881323#M307527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are around 450 expressions in each of the two QVWs and creating that many variables was really messy/confusing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, I created a composite key for each variable that looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;vCH630_877203594_Exp_79&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The other reason was that, it was calculating before the chart and ignoring the chart dimensions. Perhaps I'm missing something with that method.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 11:29:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881323#M307527</guid>
      <dc:creator />
      <dc:date>2015-06-23T11:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Only() and Expressions as Variables</title>
      <link>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881324#M307528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You pointed out the tradeoff: either a lot of variables, or complex expression work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem with your variables getting calculated before the chart won't occur if you correctly assign the proper strings to the variables in your script. $-sign substitution will happen outside the chart, but not the expression evaluation itself. Double equal signs are also a common mistake, as they block all expression evaluation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Jun 2015 11:40:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Only-and-Expressions-as-Variables/m-p/881324#M307528</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2015-06-23T11:40:31Z</dc:date>
    </item>
  </channel>
</rss>

