<?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 Parameterised variable as a string in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Parameterised-variable-as-a-string/m-p/663874#M669039</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;I'm trying to create a parameterised variable 'My_Function' and pass it a whole bunch of filters to be used in set analysis.&lt;/P&gt;&lt;P&gt;The problem is that the filters have a comma ',' between them for use in set analysis, and the function treats this as a separator for multiple variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example parameterised variable 'My_Function':&lt;/P&gt;&lt;P&gt;SUM( {&amp;lt;$1&amp;gt; } Quantity)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would call this function with:&lt;/P&gt;&lt;P&gt;My_Function($(vDateFilter),$(vType))&lt;/P&gt;&lt;P&gt;There would actually be 5+ filters and afew different combinations of them.&lt;/P&gt;&lt;P&gt;Where vDateFilter=&amp;nbsp;&amp;nbsp; Date = {"&amp;lt;=$(vMaxDate)"}&lt;/P&gt;&lt;P&gt;and vType= [LinkType] = {01}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What QlikView actually does is:&lt;/P&gt;&lt;P&gt;SUM( {&amp;lt;Date = {"&amp;lt;=$(vMaxDate)"}&amp;gt; } Quantity) and this will evaluate ok and produce a value, but the other filters such as vType do not get passed over.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like QlikView todo this&lt;/P&gt;&lt;P&gt;SUM( {&amp;lt;Date = {"&amp;lt;=$(vMaxDate)"}, [LinkType] = {01} &amp;gt; } Quantity)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried adding the comma into a variable called vComma and passing $(vDateFilter)$(vComma)$(vType)&lt;/P&gt;&lt;P&gt;Also tried various combinations of dollar expansion and quotes etc, but just not getting what I'm looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Oct 2014 10:17:48 GMT</pubDate>
    <dc:creator>peter_turner</dc:creator>
    <dc:date>2014-10-06T10:17:48Z</dc:date>
    <item>
      <title>Parameterised variable as a string</title>
      <link>https://community.qlik.com/t5/QlikView/Parameterised-variable-as-a-string/m-p/663874#M669039</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;I'm trying to create a parameterised variable 'My_Function' and pass it a whole bunch of filters to be used in set analysis.&lt;/P&gt;&lt;P&gt;The problem is that the filters have a comma ',' between them for use in set analysis, and the function treats this as a separator for multiple variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example parameterised variable 'My_Function':&lt;/P&gt;&lt;P&gt;SUM( {&amp;lt;$1&amp;gt; } Quantity)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would call this function with:&lt;/P&gt;&lt;P&gt;My_Function($(vDateFilter),$(vType))&lt;/P&gt;&lt;P&gt;There would actually be 5+ filters and afew different combinations of them.&lt;/P&gt;&lt;P&gt;Where vDateFilter=&amp;nbsp;&amp;nbsp; Date = {"&amp;lt;=$(vMaxDate)"}&lt;/P&gt;&lt;P&gt;and vType= [LinkType] = {01}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What QlikView actually does is:&lt;/P&gt;&lt;P&gt;SUM( {&amp;lt;Date = {"&amp;lt;=$(vMaxDate)"}&amp;gt; } Quantity) and this will evaluate ok and produce a value, but the other filters such as vType do not get passed over.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like QlikView todo this&lt;/P&gt;&lt;P&gt;SUM( {&amp;lt;Date = {"&amp;lt;=$(vMaxDate)"}, [LinkType] = {01} &amp;gt; } Quantity)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried adding the comma into a variable called vComma and passing $(vDateFilter)$(vComma)$(vType)&lt;/P&gt;&lt;P&gt;Also tried various combinations of dollar expansion and quotes etc, but just not getting what I'm looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 10:17:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Parameterised-variable-as-a-string/m-p/663874#M669039</guid>
      <dc:creator>peter_turner</dc:creator>
      <dc:date>2014-10-06T10:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Parameterised variable as a string</title>
      <link>https://community.qlik.com/t5/QlikView/Parameterised-variable-as-a-string/m-p/663875#M669040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;If you want to pass five parameters then you have to define five paramaters too:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;SUM( {&amp;lt;$1, $2, $3, $4, $5&amp;gt; } Quantity)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 10:24:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Parameterised-variable-as-a-string/m-p/663875#M669040</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2014-10-06T10:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Parameterised variable as a string</title>
      <link>https://community.qlik.com/t5/QlikView/Parameterised-variable-as-a-string/m-p/663876#M669041</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;I thought about that, but sometimes where will be 2 parameters, sometimes 5 or more and i was looking to cover all situations with a single 'variable'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can add additional parameters into the function, if they are 'unused' would they effect the calculations?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;SUM( {&amp;lt;$1, $2, $3, $4, $5, $6, $7, $8, $9&amp;gt; } Quantity)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;but called using&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;My_Function($(vDateFilter),$(vType))&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 10:37:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Parameterised-variable-as-a-string/m-p/663876#M669041</guid>
      <dc:creator>peter_turner</dc:creator>
      <dc:date>2014-10-06T10:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Parameterised variable as a string</title>
      <link>https://community.qlik.com/t5/QlikView/Parameterised-variable-as-a-string/m-p/663877#M669042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If they are unused they would not affect the calculation (that is what I tested). Hence, perhaps you can go with defining additional parameters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 11:25:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Parameterised-variable-as-a-string/m-p/663877#M669042</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2014-10-06T11:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Parameterised variable as a string</title>
      <link>https://community.qlik.com/t5/QlikView/Parameterised-variable-as-a-string/m-p/663878#M669043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It does look like the unused parameters don't effect the calculation, as they don't effect the selections in the Set Analysis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I've gone with the approach of adding extra parameters in case I ever need to use them.&lt;/P&gt;&lt;P&gt;Thanks for the responses!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Oct 2014 12:03:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Parameterised-variable-as-a-string/m-p/663878#M669043</guid>
      <dc:creator>peter_turner</dc:creator>
      <dc:date>2014-10-06T12:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: Parameterised variable as a string</title>
      <link>https://community.qlik.com/t5/QlikView/Parameterised-variable-as-a-string/m-p/663879#M669044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you wanted to only use one parameter you'll have to do a lot of escaping of characters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance the following expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=Sum({&amp;lt;Dim3={'Z'}, Dim2 = {'d', 'e'}&amp;gt;}Expression1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Popped into a variable and given a parameter for the set analysis:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;$1&amp;gt;} Expression1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The parameter for $1 could be in a variable 'vParamVar' say:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'Dim3={' &amp;amp; chr(39) &amp;amp; 'Z' &amp;amp; chr(39) &amp;amp; '}' &amp;amp; chr(44)&amp;nbsp; &amp;amp; 'Dim2 = {' &amp;amp; chr(39) &amp;amp; 'd' &amp;amp; chr(39) &amp;amp; chr(44) &amp;amp; chr(39) &amp;amp; 'e' &amp;amp; chr(39) &amp;amp; '}'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then to call the expression you would need todo the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(='$(Variable1(' &amp;amp; $(=vParamVar) &amp;amp; '))')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both ways have their merits!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Mar 2015 12:21:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Parameterised-variable-as-a-string/m-p/663879#M669044</guid>
      <dc:creator>thomastc</dc:creator>
      <dc:date>2015-03-09T12:21:21Z</dc:date>
    </item>
  </channel>
</rss>

