<?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 How to Set variable in Expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-Set-variable-in-Expression/m-p/149746#M27872</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="jive_text_macro jive_macro_quote" jivemacro="quote"&gt;&lt;BR /&gt;Eon wrote:Is there maybe a way I can create a little vb function in Tools -&amp;gt; Edit module and just call it from the expression?&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;No, but you can do something simliar. Put the expression in a variable ("myvar") and call it with parameters.&lt;/P&gt;&lt;P&gt;$(myexpr('Var5_4', 'd'))&lt;/P&gt;&lt;P&gt;See this similar thread for more detail: http://community.qlik.com/forums/p/18140/70920.aspx#70920&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Jul 2009 04:42:23 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2009-07-21T04:42:23Z</dc:date>
    <item>
      <title>How to Set variable in Expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-Set-variable-in-Expression/m-p/149742#M27868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;In my foreground text expression in my text object I want to define a variable. I've tried to put it in the first line but then it picks it up as text... Looks like the expression must start with a =...&lt;/P&gt;&lt;P&gt;My expression:&lt;BR /&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;=Maxstring(If([L1] = Var5_4 and [L2]=d,[L1])) &amp;amp; chr(13)&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = Var5_4 and [L2]=d,[HoverText])) &amp;amp; '.'&amp;amp; chr(13) &amp;amp;'Actual: '&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = Var5_4 and [L2]=d,[Actual])) &amp;amp; chr(13) &amp;amp;'Target: '&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = Var5_4 and [L2]=d,[Target])) &amp;amp; chr(13) &amp;amp;'Exceed: '&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = Var5_4 and [L2]=d,[Exceed])) &amp;amp; chr(13) &amp;amp;'Threshold: '&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = Var5_4 and [L2]=d,[Threshold]))&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;I want it to be something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE ___default_attr="plain" class="jive_text_macro jive_macro_code" jivemacro="code"&gt;&lt;BR /&gt;set L1Variable = Var5_4&lt;BR /&gt;set L1Variable = d&lt;BR /&gt;=Maxstring(If([L1] = L1Variable and [L2]=L1Variable ,[L1])) &amp;amp; chr(13)&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = L1Variable and [L2]=L1Variable ,[HoverText])) &amp;amp; '.'&amp;amp; chr(13) &amp;amp;'Actual: '&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = L1Variable and [L2]=L1Variable ,[Actual])) &amp;amp; chr(13) &amp;amp;'Target: '&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = L1Variable and [L2]=L1Variable ,[Target])) &amp;amp; chr(13) &amp;amp;'Exceed: '&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = L1Variable and [L2]=L1Variable ,[Exceed])) &amp;amp; chr(13) &amp;amp;'Threshold: '&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = L1Variable and [L2]=L1Variable ,[Threshold]))&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;This will save me a lot of time when duplicating the text object... Currently I need to copy the new variables in all 6 lines;) First prise will be to set the object ID as L1Variable but the defining of variables here will do for now.&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;P&gt;Eon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2009 13:43:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-Set-variable-in-Expression/m-p/149742#M27868</guid>
      <dc:creator>alerse</dc:creator>
      <dc:date>2009-07-20T13:43:59Z</dc:date>
    </item>
    <item>
      <title>How to Set variable in Expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-Set-variable-in-Expression/m-p/149743#M27869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Eon,&lt;/P&gt;&lt;P&gt;You can't define variables within the separate objects. Instead you need to define a variable in the document (can be created under Settings and Document Properties, Variables). This variable can then be references within the text object. Or any other object for that matter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2009 14:45:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-Set-variable-in-Expression/m-p/149743#M27869</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-20T14:45:10Z</dc:date>
    </item>
    <item>
      <title>How to Set variable in Expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-Set-variable-in-Expression/m-p/149744#M27870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Thanks for your reply!&lt;/P&gt;&lt;P&gt;This will not work for me... I still need to change the variables in 6 places everytime I copy the text object (and I need about 200 of them)!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2009 15:45:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-Set-variable-in-Expression/m-p/149744#M27870</guid>
      <dc:creator>alerse</dc:creator>
      <dc:date>2009-07-20T15:45:46Z</dc:date>
    </item>
    <item>
      <title>How to Set variable in Expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-Set-variable-in-Expression/m-p/149745#M27871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there maybe a way I can create a little vb function in Tools -&amp;gt; Edit module and just call it from the expression?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jul 2009 16:00:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-Set-variable-in-Expression/m-p/149745#M27871</guid>
      <dc:creator>alerse</dc:creator>
      <dc:date>2009-07-20T16:00:57Z</dc:date>
    </item>
    <item>
      <title>How to Set variable in Expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-Set-variable-in-Expression/m-p/149746#M27872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="jive_text_macro jive_macro_quote" jivemacro="quote"&gt;&lt;BR /&gt;Eon wrote:Is there maybe a way I can create a little vb function in Tools -&amp;gt; Edit module and just call it from the expression?&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;No, but you can do something simliar. Put the expression in a variable ("myvar") and call it with parameters.&lt;/P&gt;&lt;P&gt;$(myexpr('Var5_4', 'd'))&lt;/P&gt;&lt;P&gt;See this similar thread for more detail: http://community.qlik.com/forums/p/18140/70920.aspx#70920&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jul 2009 04:42:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-Set-variable-in-Expression/m-p/149746#M27872</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2009-07-21T04:42:23Z</dc:date>
    </item>
    <item>
      <title>How to Set variable in Expression</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-Set-variable-in-Expression/m-p/149747#M27873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;you can also create this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;LET L1Variable = 'Var5_4';&lt;BR /&gt;LET L2Variable = 'd';&lt;BR /&gt;=Maxstring(If([L1] = '$(L1Variable)' and [L2]='$(L2Variable)' ,[L1])) &amp;amp; chr(13)&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = '$(L1Variable)' and [L2]='$(L2Variable)' ,[HoverText])) &amp;amp; '.'&amp;amp; chr(13) &amp;amp;'Actual: '&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = '$(L1Variable)' and [L2]='$(L2Variable)' ,[Actual])) &amp;amp; chr(13) &amp;amp;'Target: '&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = '$(L1Variable)' and [L2]='$(L2Variable)' ,[Target])) &amp;amp; chr(13) &amp;amp;'Exceed: '&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = '$(L1Variable)' and [L2]='$(L2Variable)' ,[Exceed])) &amp;amp; chr(13) &amp;amp;'Threshold: '&lt;BR /&gt;&amp;amp;Maxstring(If([L1] = '$(L1Variable)' and [L2]='$(L2Variable)' ,[Threshold]))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;This way you only have to change the values of L1Variable and L2Variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings&lt;/P&gt;&lt;P&gt;Rey-man&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jul 2009 19:10:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-Set-variable-in-Expression/m-p/149747#M27873</guid>
      <dc:creator />
      <dc:date>2009-07-22T19:10:41Z</dc:date>
    </item>
  </channel>
</rss>

