<?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 Get a variable by its name in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Get-a-variable-by-its-name/m-p/231020#M82799</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good day,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to call a variable, but I would like to specify its name dynamically.&lt;/P&gt;&lt;P&gt;Let's say I have a dimension "test" and 3 variables : "varAAA", "varBBB", and "varCCC".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nowaday, I use the following syntax :&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;if(test = 'AAA', $(varAAA),&lt;BR /&gt; if(test = 'BBB', $(varBBB),&lt;BR /&gt; if(test = 'CCC', $(varCCC),&lt;BR /&gt; )))&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;If my variable were dimensions, I'ld use :&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;[var$(test)]&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;If variable could be arrays, I'ld use :&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;$(var[test])&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;If a function "getVariableByName" would exisits, I'ld use :&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;$(=getVariableByName('var' &amp;amp; test))&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there another solution ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Dec 2010 18:42:39 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-12-22T18:42:39Z</dc:date>
    <item>
      <title>Get a variable by its name</title>
      <link>https://community.qlik.com/t5/QlikView/Get-a-variable-by-its-name/m-p/231020#M82799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good day,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to call a variable, but I would like to specify its name dynamically.&lt;/P&gt;&lt;P&gt;Let's say I have a dimension "test" and 3 variables : "varAAA", "varBBB", and "varCCC".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nowaday, I use the following syntax :&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;if(test = 'AAA', $(varAAA),&lt;BR /&gt; if(test = 'BBB', $(varBBB),&lt;BR /&gt; if(test = 'CCC', $(varCCC),&lt;BR /&gt; )))&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;If my variable were dimensions, I'ld use :&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;[var$(test)]&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;If variable could be arrays, I'ld use :&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;$(var[test])&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;If a function "getVariableByName" would exisits, I'ld use :&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;$(=getVariableByName('var' &amp;amp; test))&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there another solution ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Dec 2010 18:42:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-a-variable-by-its-name/m-p/231020#M82799</guid>
      <dc:creator />
      <dc:date>2010-12-22T18:42:39Z</dc:date>
    </item>
    <item>
      <title>Get a variable by its name</title>
      <link>https://community.qlik.com/t5/QlikView/Get-a-variable-by-its-name/m-p/231021#M82800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can use this logic i believe:&lt;/P&gt;&lt;P&gt;=$(='v'&amp;amp;Test)&lt;/P&gt;&lt;P&gt;where Test is you field with values "AAA, BBB, CCC"&lt;/P&gt;&lt;P&gt;and vAAA, vBBB, vCCC are your variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if you should vary by selection:&lt;/P&gt;&lt;P&gt;it might be something like this:&lt;/P&gt;&lt;P&gt;='$(v$(=getFieldSelections(Test)))'&lt;/P&gt;&lt;P&gt;(Limitation would be works for one selection only)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Dec 2010 22:17:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-a-variable-by-its-name/m-p/231021#M82800</guid>
      <dc:creator>boorgura</dc:creator>
      <dc:date>2010-12-22T22:17:42Z</dc:date>
    </item>
    <item>
      <title>Get a variable by its name</title>
      <link>https://community.qlik.com/t5/QlikView/Get-a-variable-by-its-name/m-p/231022#M82801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rocky,&lt;/P&gt;&lt;P&gt;This doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a sample application (see attached file).&lt;/P&gt;&lt;P&gt;I would like to make an array that displays :&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;BR /&gt;ABOVE : 21000&lt;BR /&gt;BELOW : 210&lt;BR /&gt;EQUAL : 2100&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To filter my data, I have 2*3 variables :&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;// Set Analysis filters&lt;BR /&gt;LET var_sa_ABOVE = '&amp;gt;$' &amp;amp; '(=DimDate)';&lt;BR /&gt;LET var_sa_BELOW = '&amp;lt;$' &amp;amp; '(=DimDate)';&lt;BR /&gt;LET var_sa_EQUAL = '$' &amp;amp; '(=DimDate)';&lt;BR /&gt;&lt;BR /&gt;// If filters&lt;BR /&gt;LET var_if_ABOVE = 'Date &amp;gt; ' &amp;amp; 'DimDate';&lt;BR /&gt;LET var_if_BELOW = 'Date &amp;lt; ' &amp;amp; 'DimDate';&lt;BR /&gt;LET var_if_EQUAL = 'Date = ' &amp;amp; 'DimDate';&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;Nowaday, I use the following formula :&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;if(DimChoice = 'ABOVE',&lt;BR /&gt; sum({$ &amp;lt;Date={'$(=var_sa_ABOVE)'}&amp;gt;} Value),&lt;BR /&gt; if(DimChoice = 'BELOW',&lt;BR /&gt; sum({$ &amp;lt;Date={'$(=var_sa_BELOW)'}&amp;gt;} Value),&lt;BR /&gt; if(DimChoice = 'EQUAL',&lt;BR /&gt; sum({$ &amp;lt;Date={'$(=var_sa_EQUAL)'}&amp;gt;} Value),&lt;BR /&gt; )))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;or&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;if(DimChoice = 'ABOVE',&lt;BR /&gt; sum(if ( $(var_if_ABOVE), Value)),&lt;BR /&gt; if(DimChoice = 'BELOW',&lt;BR /&gt; sum(if ( $(var_if_BELOW), Value)),&lt;BR /&gt; if(DimChoice = 'EQUAL',&lt;BR /&gt; sum(if ( $(var_if_EQUAL), Value)),&lt;BR /&gt; )))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to use a formula in a single line, something like :&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;sum(if ( $(var_if_$(DimChoice)), Value))&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Dec 2010 10:29:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-a-variable-by-its-name/m-p/231022#M82801</guid>
      <dc:creator />
      <dc:date>2010-12-23T10:29:06Z</dc:date>
    </item>
  </channel>
</rss>

