<?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 Vizlib Buttons Toggle Field Selection in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Vizlib-Buttons-Toggle-Field-Selection/m-p/2113771#M90927</link>
    <description>&lt;P&gt;Hey all,&lt;/P&gt;
&lt;P&gt;Recently I have begun using the Vizlib add-on library and so far, I'm loving the customizability. The only issue I am having is that Vizlib actions are simply - different - than the built-in button actions.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Goal&lt;/FONT&gt;: I want to be able to replicate Qlik's stock built-in "toggle field selection", but on a more customizable Vizlib button. Thus, if the user has an existing selection A, B and selects C, the user should obtain A, B, C. Upon selecting C again, the user should obtain A, B. This should also work if the selection already exists, say, from a filter pane.&lt;/P&gt;
&lt;P&gt;What I've tried:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Attempt 1&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Add Action -&amp;gt; Selection in Field -&amp;gt; 'Field_A' -&amp;gt; 'A1'&lt;/P&gt;
&lt;P&gt;Result: Overwrites any existing selection to 'A1'. Also does not turn off value.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Attempt 2&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Add Action -&amp;gt; Selection in Field -&amp;gt; 'Field_A' (populated with code below)&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;if(isNull(SubstringCount(GetFieldSelections([Field_A]), 'A1')), 'A1',&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;if(SubstringCount(GetFieldSelections[Field_A]), 'A1') = 0, '(' &amp;amp; GetFieldSelections([Field_A]) &amp;amp; '|A1)',&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT size="2"&gt;Replace(GetFieldSelections([Field_A]), '|A1', ''))&lt;/FONT&gt;)&lt;FONT size="2"&gt;...similar replaces for all cases&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Result: This gives some of the functionality but with limitations. Namely, if the initial selection is made on a filter pane or similar, Qlik returns A, B. But using this logic, Qlik returns (A, B | C) which results in just C&amp;nbsp; (or in an error).&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Attempt 3&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Similar to above, but I try&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;FONT face="courier new,courier" size="2"&gt;'(' &amp;amp; GetFieldSelections([Field_A]) &amp;amp; '&lt;FONT color="#FF0000"&gt;,&lt;/FONT&gt;A1)',&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Errors. Deselects everything (probably because of a null selection).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;I'm still pretty new to Vizlib, so if anyone has any feedback or a secret way to do this by turning on a hidden option, please let me know, thanks. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Sep 2023 15:33:07 GMT</pubDate>
    <dc:creator>QlikKing99</dc:creator>
    <dc:date>2023-09-05T15:33:07Z</dc:date>
    <item>
      <title>Vizlib Buttons Toggle Field Selection</title>
      <link>https://community.qlik.com/t5/App-Development/Vizlib-Buttons-Toggle-Field-Selection/m-p/2113771#M90927</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;
&lt;P&gt;Recently I have begun using the Vizlib add-on library and so far, I'm loving the customizability. The only issue I am having is that Vizlib actions are simply - different - than the built-in button actions.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Goal&lt;/FONT&gt;: I want to be able to replicate Qlik's stock built-in "toggle field selection", but on a more customizable Vizlib button. Thus, if the user has an existing selection A, B and selects C, the user should obtain A, B, C. Upon selecting C again, the user should obtain A, B. This should also work if the selection already exists, say, from a filter pane.&lt;/P&gt;
&lt;P&gt;What I've tried:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Attempt 1&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Add Action -&amp;gt; Selection in Field -&amp;gt; 'Field_A' -&amp;gt; 'A1'&lt;/P&gt;
&lt;P&gt;Result: Overwrites any existing selection to 'A1'. Also does not turn off value.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Attempt 2&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Add Action -&amp;gt; Selection in Field -&amp;gt; 'Field_A' (populated with code below)&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;if(isNull(SubstringCount(GetFieldSelections([Field_A]), 'A1')), 'A1',&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;if(SubstringCount(GetFieldSelections[Field_A]), 'A1') = 0, '(' &amp;amp; GetFieldSelections([Field_A]) &amp;amp; '|A1)',&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT size="2"&gt;Replace(GetFieldSelections([Field_A]), '|A1', ''))&lt;/FONT&gt;)&lt;FONT size="2"&gt;...similar replaces for all cases&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Result: This gives some of the functionality but with limitations. Namely, if the initial selection is made on a filter pane or similar, Qlik returns A, B. But using this logic, Qlik returns (A, B | C) which results in just C&amp;nbsp; (or in an error).&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Attempt 3&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Similar to above, but I try&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;FONT face="courier new,courier" size="2"&gt;'(' &amp;amp; GetFieldSelections([Field_A]) &amp;amp; '&lt;FONT color="#FF0000"&gt;,&lt;/FONT&gt;A1)',&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Errors. Deselects everything (probably because of a null selection).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;I'm still pretty new to Vizlib, so if anyone has any feedback or a secret way to do this by turning on a hidden option, please let me know, thanks. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 15:33:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Vizlib-Buttons-Toggle-Field-Selection/m-p/2113771#M90927</guid>
      <dc:creator>QlikKing99</dc:creator>
      <dc:date>2023-09-05T15:33:07Z</dc:date>
    </item>
  </channel>
</rss>

