<?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: When does QV evaluate a variable value as a field and when as a text ? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/When-does-QV-evaluate-a-variable-value-as-a-field-and-when-as-a/m-p/365176#M135896</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the function you are using is expecting a field name (for example ApplyMap(), Sum(), Lookup(), etc) the variable will be expanded and its value used as a field name. Variables are quite plain in QlikView, they only store values: there are no arrays, associative values, as in other programming languages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Say that you have a table Customer and a table Vendor with CustomerAmountDue and VendorAmountDue fields in each, the variable "vCompanyType" and for some reason, you need to use this variable to build the fieldname in a chart you use Sum() already:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;SET vCompanyType = Vendor;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum($(vCompanyType)AmountDue))&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum() will evaluate the content of the variable, if that fits into a field name Sum() will return the expected result, otherwise it will return a null value or a zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 May 2012 11:08:57 GMT</pubDate>
    <dc:creator>Miguel_Angel_Baeyens</dc:creator>
    <dc:date>2012-05-23T11:08:57Z</dc:date>
    <item>
      <title>When does QV evaluate a variable value as a field and when as a text ?</title>
      <link>https://community.qlik.com/t5/QlikView/When-does-QV-evaluate-a-variable-value-as-a-field-and-when-as-a/m-p/365174#M135894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the QlikView Films sample, you can change the language by selecting it in a Multibox object, and all the texts are changed to the selected language.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, the third tab title is dynamic, defined as:&lt;/P&gt;&lt;P&gt;=Minstring(if(Reference = 'QV Guide', $(vLanguage)))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the data model there are two disconnected tables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dictionary (Reference, EN, SE, FR, DE, NL, FI, IT, DK, JP, BG, NW)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;﻿&lt;/SPAN&gt;Language (Language)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;where the attribute Language is loaded with the values EN, SE, FR, DE, NL, FI, IT, DK, JP, BG, NW (column names of Dictionary table).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;﻿&lt;/SPAN&gt;The variable vLanguage is defined at Document Properties / Variables as: &lt;/P&gt;&lt;P&gt;=Minstring(Language)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;When a language is selected, let it be "DE", this tab is titled "Bedienung", since this is the value in the table Dictionary for the field DE when the Reference field value is "QV Guide".The vLanguage variable is set to "DE", and it is evaluated as the field DE returning its Minstring value, not the constant text "DE" that I was expecting.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Then&lt;/SPAN&gt; QV is evaluating the value of the variable as a field name. &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Do you understand why QV deals with it like that ?&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;When does QV evaluate a variable value as a field name and when as a text ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;﻿&lt;/SPAN&gt;Thank you in advance. &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;﻿&lt;/SPAN&gt;J.L. Dengra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 10:49:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/When-does-QV-evaluate-a-variable-value-as-a-field-and-when-as-a/m-p/365174#M135894</guid>
      <dc:creator>jldengra</dc:creator>
      <dc:date>2012-05-23T10:49:00Z</dc:date>
    </item>
    <item>
      <title>When does QV evaluate a variable value as a field and when as a text ?</title>
      <link>https://community.qlik.com/t5/QlikView/When-does-QV-evaluate-a-variable-value-as-a-field-and-when-as-a/m-p/365175#M135895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please check the Help for dollar sign expansion:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Dollar-sign expansions are definitions of text replacements used in the script or in expressions. This process is known as expansion - even if the new text is shorter. T&lt;STRONG&gt;he replacement is made just before the script statement or the expression is evaluated&lt;/STRONG&gt;. Technically it is a macro expansion. &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;A macro expansion always begins with '$(' and ends with ') ' and the content between brackets defines how the text replacement will be done. To avoid confusion with script macros we will henceforth refer to macro expansions as dollar-sign expansions. &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So your $(vLanguage) in your expression will be replaced with DE just before the expression is evaluated, like a text replacement. The expression evaluation will take DE as a field name, just as you put the literals there manually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 11:08:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/When-does-QV-evaluate-a-variable-value-as-a-field-and-when-as-a/m-p/365175#M135895</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-05-23T11:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: When does QV evaluate a variable value as a field and when as a text ?</title>
      <link>https://community.qlik.com/t5/QlikView/When-does-QV-evaluate-a-variable-value-as-a-field-and-when-as-a/m-p/365176#M135896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the function you are using is expecting a field name (for example ApplyMap(), Sum(), Lookup(), etc) the variable will be expanded and its value used as a field name. Variables are quite plain in QlikView, they only store values: there are no arrays, associative values, as in other programming languages.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Say that you have a table Customer and a table Vendor with CustomerAmountDue and VendorAmountDue fields in each, the variable "vCompanyType" and for some reason, you need to use this variable to build the fieldname in a chart you use Sum() already:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;SET vCompanyType = Vendor;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum($(vCompanyType)AmountDue))&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum() will evaluate the content of the variable, if that fits into a field name Sum() will return the expected result, otherwise it will return a null value or a zero.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Miguel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 11:08:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/When-does-QV-evaluate-a-variable-value-as-a-field-and-when-as-a/m-p/365176#M135896</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2012-05-23T11:08:57Z</dc:date>
    </item>
  </channel>
</rss>

