<?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: Set variable when clearing selections in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395009#M147343</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, forget the triggers - too complicated. try these expressions for your button colours ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=if(vDateRange='YTD' and not(Trim(Replace(Replace('BranchView: ' &amp;amp; GetFieldSelections(BranchView),GetCurrentSelections(),''),'BranchView:',''))=''),RGB(255,0,0), RGB(0,0,255))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=if(vDateRange='MTD' and not(Trim(Replace(Replace('BranchView: ' &amp;amp; GetFieldSelections(BranchView),GetCurrentSelections(),''),'BranchView:',''))=''),RGB(255,0,0), RGB(0,0,255))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 May 2013 13:36:25 GMT</pubDate>
    <dc:creator>flipside</dc:creator>
    <dc:date>2013-05-22T13:36:25Z</dc:date>
    <item>
      <title>Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/394995#M147329</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 was wondering if there is a way to change a variable when the CLEAR button is clicked?&lt;/P&gt;&lt;P&gt;I have some date buttons that change colour when selected. they are blue but when one is clicked it changes to red (just so the user can see which date selection is active). When i clear selections the button still stays red. &lt;/P&gt;&lt;P&gt;Can anyone help me please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 08:43:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/394995#M147329</guid>
      <dc:creator>hopkinsc</dc:creator>
      <dc:date>2013-05-22T08:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/394996#M147330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can request your selections in variables e.g. with GetFieldSelections(), GetSelectedCount() or GetCurrentSelections().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 08:52:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/394996#M147330</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2013-05-22T08:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/394997#M147331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcus, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply, but i don't know what you mean..&lt;/P&gt;&lt;P&gt;I want to change a variable value when the clear selections button is clicked. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If a user selects the 'Month to Date' button, this changes a vDateSelection variable to MTD which then turns the button RED. &lt;/P&gt;&lt;P&gt;When the clear selections button is clicked the variable obviously still reads MTD which means the button is still red. &lt;/P&gt;&lt;P&gt;I want to remove the MTD value from the variable. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does that make sense?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 09:02:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/394997#M147331</guid>
      <dc:creator>hopkinsc</dc:creator>
      <dc:date>2013-05-22T09:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/394998#M147332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use a Document Event Trigger (OnAnySelect) and add a Set Variable action for a variable with the following value&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=if(IsNull(GetCurrentSelections()),'',1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 09:07:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/394998#M147332</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2013-05-22T09:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/394999#M147333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Flipside,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks thats what i wanted, the only thing is...&lt;/P&gt;&lt;P&gt;I always have a selection on a field called (BranchView), how would i add this to the formula you gave. &lt;/P&gt;&lt;P&gt;So the current selections will never be empty, there will always be a vlue in 'BranchView'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 09:15:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/394999#M147333</guid>
      <dc:creator>hopkinsc</dc:creator>
      <dc:date>2013-05-22T09:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395000#M147334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want not clear all fields, you can use GetFieldSelections() or GetSelectedCount()&amp;nbsp; - probably in combines - in the way how flipside suggested.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 09:22:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395000#M147334</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2013-05-22T09:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395001#M147335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This might work (based in this case on a field called 'Region') ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=if(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Trim(Replace('Region: ' &amp;amp; GetFieldSelections(Region),GetCurrentSelections(),''))='','',1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... or if the field can be unselected you might need ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=if(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Trim(Replace(Replace('Region: ' &amp;amp; GetFieldSelections(Region),GetCurrentSelections(),''),'Region:',''))='','',1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 09:42:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395001#M147335</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2013-05-22T09:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395002#M147336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Flipside,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have tried this ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=if(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Trim(Replace('BranchView: ' &amp;amp; GetFieldSelections(BranchView),GetCurrentSelections(),''))='','',1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it doesnt seem to work unless all selections are cleared. &lt;/P&gt;&lt;P&gt;do you have any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 09:50:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395002#M147336</guid>
      <dc:creator>hopkinsc</dc:creator>
      <dc:date>2013-05-22T09:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395003#M147337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Put the formula in a textbox and look on the result - perhaps any sign is left (CRLF).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 10:03:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395003#M147337</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2013-05-22T10:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395004#M147338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmm, bit of a tricky one - have you got anything else setting the same variable based on selections?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 10:05:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395004#M147338</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2013-05-22T10:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395005#M147339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no, the only thing that set the variable are 5 date button. but obviously when clearing the selections these dates are cleared also (which is correct). nothing else sets the variable value. &lt;/P&gt;&lt;P&gt;it works perfectly if i remove the BranchView selection, but i need this selected always. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 10:15:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395005#M147339</guid>
      <dc:creator>hopkinsc</dc:creator>
      <dc:date>2013-05-22T10:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395006#M147340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=if(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Trim(Replace('BranchView: ' &amp;amp; GetFieldSelections(BranchView),GetCurrentSelections(),''))='','')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or perhaps if you can upload an example, maybe there's a better way!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 10:18:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395006#M147340</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2013-05-22T10:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395007#M147341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi flipside,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached a quick sample..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have set a clear state so when clear is clicked it selects 'BranchView = Branch'&lt;/P&gt;&lt;P&gt;there is a variable called vDateRange &lt;/P&gt;&lt;P&gt;the buttons set the variable and make a date selection, and the button colours are calculated based on the variable value. &lt;/P&gt;&lt;P&gt;Any more help would be greatly appreciated &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 10:44:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395007#M147341</guid>
      <dc:creator>hopkinsc</dc:creator>
      <dc:date>2013-05-22T10:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395008#M147342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Must be the Clear State causing it to do this - I have never used this option!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure of a way around it at the moment, but if I think of something I'll post a reply.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 11:11:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395008#M147342</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2013-05-22T11:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395009#M147343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, forget the triggers - too complicated. try these expressions for your button colours ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=if(vDateRange='YTD' and not(Trim(Replace(Replace('BranchView: ' &amp;amp; GetFieldSelections(BranchView),GetCurrentSelections(),''),'BranchView:',''))=''),RGB(255,0,0), RGB(0,0,255))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=if(vDateRange='MTD' and not(Trim(Replace(Replace('BranchView: ' &amp;amp; GetFieldSelections(BranchView),GetCurrentSelections(),''),'BranchView:',''))=''),RGB(255,0,0), RGB(0,0,255))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;flipside&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 May 2013 13:36:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395009#M147343</guid>
      <dc:creator>flipside</dc:creator>
      <dc:date>2013-05-22T13:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: Set variable when clearing selections</title>
      <link>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395010#M147344</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 actually got this working by resetting the clear state, adding a list box for the BranchView field, then in the properties of that list box i ticked 'Always one Selected Value'. Deleted the list box. &lt;/P&gt;&lt;P&gt;That gave the same result as using the 'Set Clear State' option. &lt;/P&gt;&lt;P&gt;Then i used your solution above..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;&lt;STRONG&gt;=if(&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Trim(Replace('Region: ' &amp;amp; GetFieldSelections(Region),GetCurrentSelections(),''))='','',1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which did the trick &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 May 2013 15:17:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-variable-when-clearing-selections/m-p/395010#M147344</guid>
      <dc:creator>hopkinsc</dc:creator>
      <dc:date>2013-05-24T15:17:33Z</dc:date>
    </item>
  </channel>
</rss>

