<?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 HOWTO: Assign a variable to another variable through an Action expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/HOWTO-Assign-a-variable-to-another-variable-through-an-Action/m-p/151926#M502209</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I recently ran into a situation where I want to change a chart expression, based on a selection.&lt;/P&gt;&lt;P&gt;The easy way to do this is by having the expression saved as a variable, and then assigning that variable name to the placeholder variable contained within the expression.&lt;/P&gt;&lt;P&gt;So far so good. However, where things fall down is if you attempt to assign _the name_ of a variable to another variable from within a trigger action. Namely, QlikView wants to resolve the contents of the variable as opposed to the name of the variable.&lt;/P&gt;&lt;P&gt;One solution is to make the assignment within a macro (e.g. VBScript or JScript). However, I prefer to avoid using Macros as they result in more code to maintain, and often have performance limitations.&lt;/P&gt;&lt;P&gt;The trick turns out to be relatively simple. Namely, just concatenate the $ part of the variable reference to the rest of the variable name.&lt;/P&gt;&lt;P&gt;I have pasted the code below to show you what I mean:&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;='$' &amp;amp; if(OH_hierarchy_levels_entity_name = 'Org3HierarchyLevels', '(CurrentScoreExpression7Levels)', '(CurrentScoreExpression6Levels)')&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Oct 2010 20:15:21 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-10-20T20:15:21Z</dc:date>
    <item>
      <title>HOWTO: Assign a variable to another variable through an Action expression</title>
      <link>https://community.qlik.com/t5/QlikView/HOWTO-Assign-a-variable-to-another-variable-through-an-Action/m-p/151926#M502209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I recently ran into a situation where I want to change a chart expression, based on a selection.&lt;/P&gt;&lt;P&gt;The easy way to do this is by having the expression saved as a variable, and then assigning that variable name to the placeholder variable contained within the expression.&lt;/P&gt;&lt;P&gt;So far so good. However, where things fall down is if you attempt to assign _the name_ of a variable to another variable from within a trigger action. Namely, QlikView wants to resolve the contents of the variable as opposed to the name of the variable.&lt;/P&gt;&lt;P&gt;One solution is to make the assignment within a macro (e.g. VBScript or JScript). However, I prefer to avoid using Macros as they result in more code to maintain, and often have performance limitations.&lt;/P&gt;&lt;P&gt;The trick turns out to be relatively simple. Namely, just concatenate the $ part of the variable reference to the rest of the variable name.&lt;/P&gt;&lt;P&gt;I have pasted the code below to show you what I mean:&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;='$' &amp;amp; if(OH_hierarchy_levels_entity_name = 'Org3HierarchyLevels', '(CurrentScoreExpression7Levels)', '(CurrentScoreExpression6Levels)')&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 20:15:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/HOWTO-Assign-a-variable-to-another-variable-through-an-Action/m-p/151926#M502209</guid>
      <dc:creator />
      <dc:date>2010-10-20T20:15:21Z</dc:date>
    </item>
  </channel>
</rss>

