<?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: Can I SET or LET a variable to include a $(=...) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023254#M346012</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All of these answers solve the issue. I'd like to mark them all correct. I used @Peter's approach, so I'll pick that one.&lt;/P&gt;&lt;P&gt;I do like @Tamil's approach because it does not require string concatenation -- it does not break up the "flow" of the statement. None are as elegant as I was hoping for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks all!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Jan 2016 15:50:35 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-01-05T15:50:35Z</dc:date>
    <item>
      <title>Can I SET or LET a variable to include a $(=...)</title>
      <link>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023250#M346008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want my variable, vPop, to look like this: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM({$&amp;lt;Year={&lt;STRONG&gt;$(=MAX(Year))&lt;/STRONG&gt;}&amp;gt;}Population)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notice the part in bold.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;See in attached ; open the variable view&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I do this in SET or LET in the Load Script&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET vPop = SUM({$&amp;lt;Year={$(=MAX(Year))}&amp;gt;}Population);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After reloading, the value of vPop is this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SUM({$&amp;lt;Year={}&amp;gt;}Population)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And therefore $(vPop) evaluates to 0&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I managed to do it by separating "$"&amp;nbsp; from the "("&amp;nbsp; and concatenating them together -- but it's ugly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jan 2016 04:08:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023250#M346008</guid>
      <dc:creator />
      <dc:date>2016-01-05T04:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can I SET or LET a variable to include a $(=...)</title>
      <link>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023251#M346009</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes '$' would cause expansion, so you have to use a bit ugly way, like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LET&lt;/STRONG&gt; vPop = 'SUM({&amp;lt;Year={&lt;STRONG&gt;'&amp;amp;chr(36)&amp;amp;'&lt;/STRONG&gt;(=MAX(Year))}&amp;gt;}Population)';&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jan 2016 07:53:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023251#M346009</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2016-01-05T07:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Can I SET or LET a variable to include a $(=...)</title>
      <link>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023252#M346010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;You can use any symbols instead of dollar sign and replace it by using replace function like below,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;LET vPop = Replace('SUM({&amp;lt;Year={&lt;SPAN style="color: #ff0000;"&gt;@&lt;/SPAN&gt;(=MAX(Year))}&amp;gt;}Population)', '&lt;SPAN style="color: #ff0000;"&gt;@&lt;/SPAN&gt;' , '&lt;SPAN style="color: #ff0000;"&gt;$&lt;/SPAN&gt;');&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jan 2016 08:22:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023252#M346010</guid>
      <dc:creator>tamilarasu</dc:creator>
      <dc:date>2016-01-05T08:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can I SET or LET a variable to include a $(=...)</title>
      <link>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023253#M346011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This should work too, since the $-sign substitution is applied to the raw statement text, before the statement is actually parsed and evaluated:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 10pt;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;LET&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d;"&gt; vPop = 'SUM({&amp;lt;Year={&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;' &amp;amp; '$' &amp;amp; '&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-size: 10pt; font-family: 'courier new', courier;"&gt;(=MAX(Year))}&amp;gt;}Population)';&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;BTW these are all tricks to sort-of mislead the $-sign expansion process. For the moment, that is.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jan 2016 08:33:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023253#M346011</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2016-01-05T08:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: Can I SET or LET a variable to include a $(=...)</title>
      <link>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023254#M346012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All of these answers solve the issue. I'd like to mark them all correct. I used @Peter's approach, so I'll pick that one.&lt;/P&gt;&lt;P&gt;I do like @Tamil's approach because it does not require string concatenation -- it does not break up the "flow" of the statement. None are as elegant as I was hoping for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks all!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jan 2016 15:50:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023254#M346012</guid>
      <dc:creator />
      <dc:date>2016-01-05T15:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Can I SET or LET a variable to include a $(=...)</title>
      <link>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023255#M346013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And Steve Dark mentions the same, here:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.quickintelligence.co.uk/qlikview-include-files/" title="http://www.quickintelligence.co.uk/qlikview-include-files/"&gt;http://www.quickintelligence.co.uk/qlikview-include-files/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P style="margin: 0 0 10px; color: #747474; font-family: 'PT Sans', Arial, Helvetica, sans-serif; font-size: 14px;"&gt;The simplest way to not have it do the replace is use a different character for the $ symbol, and then replace it afterwards, ie:&lt;/P&gt;
&lt;P style="margin: 0 0 10px; color: #747474; font-family: 'PT Sans', Arial, Helvetica, sans-serif; font-size: 14px;"&gt;set vMyVariable = sum(¬(vSelectedMeasure));&lt;BR /&gt;let vMyVariable = replace(vMyVariable, ‘¬’, ‘$’);&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jan 2016 22:26:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023255#M346013</guid>
      <dc:creator />
      <dc:date>2016-01-08T22:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can I SET or LET a variable to include a $(=...)</title>
      <link>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023256#M346014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Note: This requires the use of `LET` (not SET)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jan 2016 22:27:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023256#M346014</guid>
      <dc:creator />
      <dc:date>2016-01-08T22:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Can I SET or LET a variable to include a $(=...)</title>
      <link>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023257#M346015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You do have a point of course. QlikView script is not an elegant language, far from it. It's a collection of good ideas welded together. You already know them: QlikView native script, SQL, VBScript and a sort of preprocessor that handles text substitution and which is a typical compiler technique patched onto an &lt;EM&gt;interpreter&lt;/EM&gt;. The surprising thing is that it works and it works pretty well. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the other hand, the knowledge required to predict how a specific script will interact/behave is pretty vaste. That's why I think the community is an invaluable resource. So go on, and ask questions. You're welcome. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enjoy QlikView and the Qlik Community.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Jan 2016 15:59:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023257#M346015</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2016-01-09T15:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can I SET or LET a variable to include a $(=...)</title>
      <link>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023258#M346016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah, I guess I'm not an expert on "elegant".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In fact I quite like the text-substitution, I think the adjective that comes to mind is "powerful". Esp. in combo with all the other stuff you mentioned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess I was just hoping for an escape character, $\(...) &lt;/P&gt;&lt;P&gt;or a switch to turn off the $ substitution behavior for a few lines (and turn it back-on again) --ala QUALIFY and UNQUALIFY -- DOLLAR_SUBSTITUTION_OFF and DOLLAR_SUBSTITUTION_ON&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess I should go to Qlikview feature suggestion -- I'm curious if others have faced this too, and if they have other suggestions besides escape character or a "switch"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But string concatenation and string substitution both allow me to do what I need, "powerful", just a little stilted reading the script&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Jan 2016 18:29:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023258#M346016</guid>
      <dc:creator />
      <dc:date>2016-01-09T18:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Can I SET or LET a variable to include a $(=...)</title>
      <link>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023259#M346017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can put all your variables (or at least the ones with chart expressions, potentially containing dollar sign expansions) into e.g. an excel file with two columns and read the excel in like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Variables:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD Variable, &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Expression&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;[Variables.xls]&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;(biff, embedded labels, table is Tabelle1$);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let vNo = NoOfRows('Variables');&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For vI = 0 to (vNo - 1)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let vVariableName = Peek('Variable',vI,'Variables');&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let [$(vVariableName)] = Peek('Expression',vI,'Variables');&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Next&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Doing so, you can use dollar sign expansions etc. in your excel columns with the need for a special treatment (except maybe a leading single quote before potential equal signs to avoid Excel evaluating your expressions...)&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jan 2016 11:00:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023259#M346017</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-01-11T11:00:12Z</dc:date>
    </item>
    <item>
      <title>Re: Can I SET or LET a variable to include a $(=...)</title>
      <link>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023260#M346018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oooh, another clever suggestion, I didn't think of that.&lt;/P&gt;&lt;P&gt;I really like it because I can &lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Maintain variables in plain text (all of these answers support that&amp;nbsp; (a QVS supports that)-- but swuehl's suggestion forces you to separate variable definitions from other LOAD -- for better or worse [I think it's for better])&lt;/LI&gt;&lt;LI&gt;I can use dollar-signs without "workarounds" like substitution or string concatenation. Therefore my variable is uninterrupted and easier to read and write.&lt;/LI&gt;&lt;LI&gt;AND bonus: I could edit it in Excel or some CSV editor so I get the look-and-feel of the variable UI in Qlikview (Ctrl+Alt+V), and the advantage of extra columns (i.e. a "Comment" column)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you said:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Doing so, you can use dollar sign expansions etc. in your excel columns with the need for a special treatment&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;Did you mean:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;without the need&lt;/STRONG&gt; for special treatment&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>Mon, 11 Jan 2016 17:29:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023260#M346018</guid>
      <dc:creator />
      <dc:date>2016-01-11T17:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Can I SET or LET a variable to include a $(=...)</title>
      <link>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023261#M346019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jan 2016 20:59:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Can-I-SET-or-LET-a-variable-to-include-a/m-p/1023261#M346019</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2016-01-11T20:59:05Z</dc:date>
    </item>
  </channel>
</rss>

