<?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: Simpler way to call variables in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Simpler-way-to-call-variables/m-p/514549#M481533</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you tried as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a variable (ex:vBrand) and assign below expression to that variable.&lt;/P&gt;&lt;P&gt;vBrand='v'&amp;amp;Brand&lt;/P&gt;&lt;P&gt;now, you can use this variable as $(vBrand)&lt;/P&gt;&lt;P&gt;See the attachment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 06 Oct 2013 12:47:14 GMT</pubDate>
    <dc:creator />
    <dc:date>2013-10-06T12:47:14Z</dc:date>
    <item>
      <title>Simpler way to call variables</title>
      <link>https://community.qlik.com/t5/QlikView/Simpler-way-to-call-variables/m-p/514547#M481531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inside a chart with one dimension (Brand), I'm calling a variable in an expression like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if(Brand='Mercedes',vMercedes,if(Brand='BMW',vBMW,if(Brand='Peugeot',vPeugeot))) // and so on&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works but is not efficient. I have to write an if statement for every brand and I have to change this if more brands come in.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried many different approaches like:&lt;/P&gt;&lt;P&gt;=$('v'&amp;amp;Brand)&lt;/P&gt;&lt;P&gt;or just&lt;/P&gt;&lt;P&gt;='v'&amp;amp;Brand&lt;/P&gt;&lt;P&gt;and many other things that fail calling the variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a simple way to do it without all the if's?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much,&lt;/P&gt;&lt;P&gt;Nuno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Oct 2013 10:21:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Simpler-way-to-call-variables/m-p/514547#M481531</guid>
      <dc:creator />
      <dc:date>2013-10-06T10:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: Simpler way to call variables</title>
      <link>https://community.qlik.com/t5/QlikView/Simpler-way-to-call-variables/m-p/514548#M481532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nuno,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the idea is nice, but I believe you get a hard time doing this with variable name construction / dollar sign expansion because of the way QV evaluates the expression / dollar sign expansion variables.&lt;/P&gt;&lt;P&gt;I think you won't get QV to return you the current dimension value, then let you combine the dimension value with some other character to form a variable name, then re-evaluates this as variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In princinple, I would do your conditional logic like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=pick( match( Brand, 'Mercedes', 'BMW','Peugeot'), vMercedes, vBMW, vPeugeot)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create a variable that builds this dynamically, then try to call the variable in your expression, like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;='pick(match(Brand,'&amp;amp;chr(39)&amp;amp;concat({1} Brand,chr(39)&amp;amp;','&amp;amp;chr(39))&amp;amp;chr(39)&amp;amp;&lt;/P&gt;&lt;P&gt;') ,v'&amp;amp;concat({1} Brand,' ,v') &amp;amp;')'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Oct 2013 11:05:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Simpler-way-to-call-variables/m-p/514548#M481532</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-10-06T11:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Simpler way to call variables</title>
      <link>https://community.qlik.com/t5/QlikView/Simpler-way-to-call-variables/m-p/514549#M481533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you tried as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a variable (ex:vBrand) and assign below expression to that variable.&lt;/P&gt;&lt;P&gt;vBrand='v'&amp;amp;Brand&lt;/P&gt;&lt;P&gt;now, you can use this variable as $(vBrand)&lt;/P&gt;&lt;P&gt;See the attachment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Oct 2013 12:47:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Simpler-way-to-call-variables/m-p/514549#M481533</guid>
      <dc:creator />
      <dc:date>2013-10-06T12:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: Re: Simpler way to call variables</title>
      <link>https://community.qlik.com/t5/QlikView/Simpler-way-to-call-variables/m-p/514550#M481534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This only works if you select a Brand value, not when you need to use it in chart's expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've adapted this file to show what I suggested above.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Oct 2013 12:58:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Simpler-way-to-call-variables/m-p/514550#M481534</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2013-10-06T12:58:25Z</dc:date>
    </item>
  </channel>
</rss>

