<?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 Why we use $ sign before variable in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Why-we-use-sign-before-variable/m-p/861929#M652959</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can anybody explain me the whole mechanism why to use $ sign before varibale...and if we not use that what happens.How it works all can any body explain clearly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vasudha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Jul 2015 12:00:10 GMT</pubDate>
    <dc:creator />
    <dc:date>2015-07-13T12:00:10Z</dc:date>
    <item>
      <title>Why we use $ sign before variable</title>
      <link>https://community.qlik.com/t5/QlikView/Why-we-use-sign-before-variable/m-p/861929#M652959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can anybody explain me the whole mechanism why to use $ sign before varibale...and if we not use that what happens.How it works all can any body explain clearly&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vasudha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 12:00:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-we-use-sign-before-variable/m-p/861929#M652959</guid>
      <dc:creator />
      <dc:date>2015-07-13T12:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Why we use $ sign before variable</title>
      <link>https://community.qlik.com/t5/QlikView/Why-we-use-sign-before-variable/m-p/861930#M652960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can read below two blogs which will give you clear understanding how $ sign works.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/3406"&gt;The Magic of Variables&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/3444"&gt;The Magic of Dollar Expansions&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 12:03:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-we-use-sign-before-variable/m-p/861930#M652960</guid>
      <dc:creator>MK_QSL</dc:creator>
      <dc:date>2015-07-13T12:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: Why we use $ sign before variable</title>
      <link>https://community.qlik.com/t5/QlikView/Why-we-use-sign-before-variable/m-p/861931#M652961</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;One that is available in QV help section:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H1&gt;&lt;A name="kanchor577"&gt;&lt;/A&gt;Dollar-Sign Expansions&lt;/H1&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dollar-sign expansions are definitions of text replacements used in the &lt;BR /&gt;script or in expressions. This process is known as expansion - even if the new &lt;BR /&gt;text is shorter. The replacement is made just before the script statement or the &lt;BR /&gt;expression is evaluated. Technically it is a macro expansion. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A macro expansion always begins with '$(' and ends with ') ' and the content &lt;BR /&gt;between brackets defines how the text replacement will be done. To avoid &lt;BR /&gt;confusion with script macros we will henceforth refer to macro expansions as &lt;BR /&gt;dollar-sign expansions. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="note"&gt;&lt;SPAN class="Bold"&gt;Note!&lt;/SPAN&gt; &lt;BR /&gt;Macro expansion is unrelated &lt;BR /&gt;to script macros (VB or Java script defined in the script module). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="note"&gt;&lt;SPAN class="Bold"&gt;Note!&lt;/SPAN&gt; &lt;BR /&gt;A dollar-sign expansion is &lt;BR /&gt;limited in how many macro expansions it can calculate. Any expansion over 1000 &lt;BR /&gt;will not be calculated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Dollar-Sign Expansion Using a Variable&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When using a variable for text replacement in the script or in an expression, &lt;BR /&gt;the following syntax is used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;$&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt;( &lt;BR /&gt;variablename )&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Bold"&gt;$&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt;( variablename)&lt;/SPAN&gt; expands to &lt;BR /&gt;the value in &lt;SPAN class="Italic"&gt;variablename&lt;/SPAN&gt;. If &lt;SPAN class="Italic"&gt;variablename&lt;/SPAN&gt; does not exist the expansion will be the empty &lt;BR /&gt;string. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For numeric variable expansions, the syntax &lt;SPAN class="Bold"&gt;$&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt;( variablename )&lt;/SPAN&gt; will generate a number using the regional &lt;BR /&gt;decimal separator, i.e. for many countries a decimal comma. Such an expansion &lt;BR /&gt;should not be used for numbers inside the script since these must use decimal &lt;BR /&gt;point. Instead the expansion $(# variablename ) should be used. (Note the hash &lt;BR /&gt;sign). It always yields a valid decimal-point representation of the numeric &lt;BR /&gt;value of &lt;SPAN class="Italic"&gt;variablename&lt;/SPAN&gt;, possibly with exponential &lt;BR /&gt;notation (for very large/small numbers). If &lt;SPAN class="Italic"&gt;variablename&lt;/SPAN&gt; does not exist or does not contain a numeric &lt;BR /&gt;value, it will be expanded to &lt;SPAN class="Italic"&gt;0&lt;/SPAN&gt; instead. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="example"&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: italic;"&gt;After &lt;BR /&gt;execution of the following script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="Code"&gt;SET DecimalSep=',';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="Code"&gt;LET X = 7/2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(X ) will expand to 3,5 while $(#X ) will expand &lt;BR /&gt;to 3.5. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="example"&gt;Examples:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="Code"&gt;set Mypath=C:\MyDocs\Files\&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="Code"&gt;... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="Code"&gt;load * from $(MyPath)abc.csv;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="Code"&gt;set CurrentYear=1992;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="Code"&gt;... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="Code"&gt;select * from table1 where Year=$(CurrentYear);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Dollar-Sign Expansion with Parameters&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parameters can be used in variable expansions. The variable must then contain &lt;BR /&gt;formal parameters, such as $1, $2, $3 etc. When expanding the variable, the &lt;BR /&gt;parameters should be stated in a comma separated list. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="example"&gt;Examples:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="Code"&gt;set MUL=’$1*$2’;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;set X=$(MUL(3,7)); //&lt;/SPAN&gt; returns '3*7' in X&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;let X=$(MUL(3,7)); //&lt;/SPAN&gt; returns 21 in X&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the number of formal parameters exceeds the number of actual parameters &lt;BR /&gt;only the formal parameters corresponding to actual parameters will be expanded. &lt;BR /&gt;If the number of actual parameters exceeds the number of formal parameters the &lt;BR /&gt;superfluous actual parameters will be ignored. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="example"&gt;Examples:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="Code"&gt;set MUL=’$1*$2’;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;set X=$(MUL); //&lt;/SPAN&gt; returns '$1*$2' in X&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;set X=$(MUL(10)); //&lt;/SPAN&gt; returns '10*$2' in X&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;let X=$(MUL(5,7,8)); //&lt;/SPAN&gt; returns 35 in X&lt;/P&gt;&lt;P&gt;The parameter $0 returns the number of parameters actually passed by a call. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="example"&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="Code"&gt;set MUL='$1*$2 $0 par'; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;set X=$(MUL(3,7)); &lt;BR /&gt;//&lt;/SPAN&gt; returns '3*7 2 par' in X &lt;/P&gt;&lt;H2&gt;Dollar-Sign Expansion with an Expression&lt;/H2&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expressions can be used in dollar-sign expansions. &lt;BR /&gt;The content between the brackets must then start with an equal sign: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$( =expression )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The expression will be evaluated and the value will &lt;BR /&gt;be used in the expansion. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="example"&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;$(=Year(Today())); //&lt;/SPAN&gt; returns e.g. '2008'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="Code"&gt;$(=Only(Year)-1); //&lt;/SPAN&gt; returns the year before the &lt;BR /&gt;selected one&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H3&gt;Dollar-Sign Expansion of File - Include Statement&lt;/H3&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;File inclusions are made using dollar-sign &lt;BR /&gt;expansions. The syntax is then:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$( include=filename )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above text will be replaced by the content of &lt;BR /&gt;the file specified after the equal sign. This feature is very useful when &lt;BR /&gt;storing scripts or parts of scripts in text files. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="example"&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="Code"&gt;$(include=C:\Documents\MyScript.qvs);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 12:04:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-we-use-sign-before-variable/m-p/861931#M652961</guid>
      <dc:creator />
      <dc:date>2015-07-13T12:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Why we use $ sign before variable</title>
      <link>https://community.qlik.com/t5/QlikView/Why-we-use-sign-before-variable/m-p/861932#M652962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just a small warning: be precise when dealing with special symbols and punctuation marks (You will be glad I said this once you start working with set analysis &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;) or posting on the community about these elements..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can put a $-sign in front of a variable without any problem, and the variable will still be a variable. For example, this script statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LET $Variable = 5 * 7;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will store the value 35 in variable &lt;SPAN style="font-family: 'courier new', courier;"&gt;$Variable&lt;/SPAN&gt;. No expansion whatsoever. Here the $-sign is part of the variable name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's a different ball game when you use &lt;SPAN style="font-family: 'courier new', courier;"&gt;$(&lt;EM&gt;stuff&lt;/EM&gt;)&lt;/SPAN&gt; (the dollar sign is followed by opening and closing parentheses and inbetween there is ... stuff) because this doesn't define/reference anything. It's a construct that leads to text subsitution before anything else is done with the resulting expression or statement. The stuff inside the parentheses may consist of variable names, special elements (e.g. &lt;SPAN style="font-family: 'courier new', courier;"&gt;include = path&lt;/SPAN&gt;), expressions, references to other variables, entire pseudo function calls etc. that may produce text output ranging from nothing at all to entire files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the mightiest thing about $-sign substituion is: &lt;EM&gt;you can use it almost anywhere!&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pretty powerful stuff &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jul 2015 12:21:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Why-we-use-sign-before-variable/m-p/861932#M652962</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2015-07-13T12:21:20Z</dc:date>
    </item>
  </channel>
</rss>

