<?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 Use macro to build up set analysis variable from selected values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Use-macro-to-build-up-set-analysis-variable-from-selected-values/m-p/148631#M26902</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to be able to build up the Set Analysis string and place it in a variable based on the current selections...&lt;/P&gt;&lt;P&gt;ie. A user clicks a button and the macro gets all the current selections and then builds up the set analysis string from this eg. sum( {1&amp;lt;Year={"2005"},Month={"jan","feb"},CategoryName={"b*"},ProductName&amp;lt;&amp;gt;{"Ballet Shoes"}&amp;gt;] Amount)&lt;/P&gt;&lt;P&gt;I want to replace this with sum($(vSetAnalysis) Amount) and set the variable vSetAnalysis in the macro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Jul 2009 02:54:42 GMT</pubDate>
    <dc:creator>renem</dc:creator>
    <dc:date>2009-07-07T02:54:42Z</dc:date>
    <item>
      <title>Use macro to build up set analysis variable from selected values</title>
      <link>https://community.qlik.com/t5/QlikView/Use-macro-to-build-up-set-analysis-variable-from-selected-values/m-p/148631#M26902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to be able to build up the Set Analysis string and place it in a variable based on the current selections...&lt;/P&gt;&lt;P&gt;ie. A user clicks a button and the macro gets all the current selections and then builds up the set analysis string from this eg. sum( {1&amp;lt;Year={"2005"},Month={"jan","feb"},CategoryName={"b*"},ProductName&amp;lt;&amp;gt;{"Ballet Shoes"}&amp;gt;] Amount)&lt;/P&gt;&lt;P&gt;I want to replace this with sum($(vSetAnalysis) Amount) and set the variable vSetAnalysis in the macro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2009 02:54:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-macro-to-build-up-set-analysis-variable-from-selected-values/m-p/148631#M26902</guid>
      <dc:creator>renem</dc:creator>
      <dc:date>2009-07-07T02:54:42Z</dc:date>
    </item>
    <item>
      <title>Use macro to build up set analysis variable from selected values</title>
      <link>https://community.qlik.com/t5/QlikView/Use-macro-to-build-up-set-analysis-variable-from-selected-values/m-p/148632#M26903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To get the selections in a field, you can use GetFieldSelections(FieldName). This will return a comma separated list of the selected values for a particular field.&lt;/P&gt;&lt;P&gt;As for your vSetAnalysis variable, it would need to be defined as a concatenation of your fields and GetFieldSelections results.&lt;/P&gt;&lt;P&gt;When no values are selected in a field, you would need a modification as that would get you a null value. You could use something like If(IsNull(GetFieldSelections(FieldName), '*', GetFieldSelections(FieldName). That way if nothing is selected, then you would look for anything. I would think that is the behavior you want, but that depends on your data and app.&lt;/P&gt;&lt;P&gt;I don't know if there is a way to automatically create the field list for you. It should be possible using a macro and the API to loop through possible fields and creare that Set Analysis string. If you're going to pre-define all the fields that need to be included, then it can probably be done without a macro, although it will probably end up being a very long variable definition.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2009 03:08:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-macro-to-build-up-set-analysis-variable-from-selected-values/m-p/148632#M26903</guid>
      <dc:creator />
      <dc:date>2009-07-07T03:08:36Z</dc:date>
    </item>
    <item>
      <title>Use macro to build up set analysis variable from selected values</title>
      <link>https://community.qlik.com/t5/QlikView/Use-macro-to-build-up-set-analysis-variable-from-selected-values/m-p/148633#M26904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi renem - I'm trying to achieve something similar to this - have you managed to resolve it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Aug 2009 15:48:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-macro-to-build-up-set-analysis-variable-from-selected-values/m-p/148633#M26904</guid>
      <dc:creator />
      <dc:date>2009-08-20T15:48:35Z</dc:date>
    </item>
    <item>
      <title>Use macro to build up set analysis variable from selected values</title>
      <link>https://community.qlik.com/t5/QlikView/Use-macro-to-build-up-set-analysis-variable-from-selected-values/m-p/148634#M26905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you need the full list of values when nothing is selected you can use the concat() function.&lt;/P&gt;&lt;P&gt;=Concat(Field,';')&lt;/P&gt;&lt;P&gt;The first parameter is the list to concatenate and the second parameter is the separator between the values.&lt;/P&gt;&lt;P&gt;//jsn&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Aug 2009 16:03:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-macro-to-build-up-set-analysis-variable-from-selected-values/m-p/148634#M26905</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-08-20T16:03:27Z</dc:date>
    </item>
  </channel>
</rss>

