<?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: Custom Slicer Loses Value When Toggling Visibility in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Loses-Value-When-Toggling-Visibility/m-p/1099615#M23786</link>
    <description>&lt;P&gt;I attempted to use the filtering API and it solved half of my problem.&amp;nbsp; Now, when I hide the visual the filter does not go away, but when I make the visual visable again, the filter gets lost.&amp;nbsp; Is there something I should be doing to persist the filter behind the scenes and reload it when making the visual visable again?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code in the update method:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;        let filterTarget: IFilterColumnTarget = {
            table: categories.source.queryName.substr(0, categories.source.queryName.indexOf('.')),
            column: categories.source.displayName
        };
        
        const basicFilter: IBasicFilter = {
            $schema: "http://powerbi.com/product/schema#basic",
            // target: {
            //     table:"Date",
            //     column:"CalendarYear"
            // },
            target: filterTarget,
            operator: "In",
            values: [dateSelectionValue], //[2019],
            filterType: FilterType.Basic
        }

        this.visualHost.applyJsonFilter(basicFilter, "general", "filter", FilterAction.merge);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I added to the capabilities file:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"general": {
            "displayName": "General",
            "displayNameKey": "formattingGeneral",
            "properties": {
                "filter": {
                    "type": {
                        "filter": true
                    }
                },
                "selfFilter": {
                    "type": {
                        "filter": {
                            "selfFilter": true
                        }
                    }
                }
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Wed, 20 May 2020 23:13:09 GMT</pubDate>
    <dc:creator>cboneill0099</dc:creator>
    <dc:date>2020-05-20T23:13:09Z</dc:date>
    <item>
      <title>Custom Slicer Loses Value When Toggling Visibility</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Loses-Value-When-Toggling-Visibility/m-p/1088490#M23660</link>
      <description>&lt;P&gt;I have a custom slicer I wrote that filters dates.&amp;nbsp; It's pretty basic, you just give it a date field and it lets you filter the report down to a single date.&amp;nbsp; The issue I'm having with it is if I select a date, the report filters down correctly.&amp;nbsp; If I then hide the visual it loses the selection and the filter is gone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble finding documentation on what's happening behind the scenes when it's hidden.&amp;nbsp; Can anyone give me some insights into what's going on and if there is some type of special handling for this secenario?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 20:05:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Loses-Value-When-Toggling-Visibility/m-p/1088490#M23660</guid>
      <dc:creator>cboneill0099</dc:creator>
      <dc:date>2020-05-13T20:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Slicer Loses Value When Toggling Visibility</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Loses-Value-When-Toggling-Visibility/m-p/1089077#M23672</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="155781" data-lia-user-login="cboneill0099" class="lia-mention lia-mention-user"&gt;cboneill0099&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Seems it act like a visual interaction instead of filter, please try to&amp;nbsp;&lt;SPAN&gt;added the&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://github.com/Microsoft/powerbi-visuals-sampleslicer/blob/master/doc/AddingInteractivityUtils.md" target="_blank" rel="nofollow noopener noreferrer"&gt;Advanced Filter API&lt;/A&gt; based on this similar thread:&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Developer/Custom-Slicer-Selection-Issue/td-p/371992" target="_blank"&gt;https://community.powerbi.com/t5/Developer/Custom-Slicer-Selection-Issue/td-p/371992&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 06:41:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Loses-Value-When-Toggling-Visibility/m-p/1089077#M23672</guid>
      <dc:creator>v-lid-msft</dc:creator>
      <dc:date>2020-05-14T06:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Slicer Loses Value When Toggling Visibility</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Loses-Value-When-Toggling-Visibility/m-p/1089665#M23683</link>
      <description>&lt;P&gt;Thank you.&amp;nbsp; I'll give that a shot.&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2020 12:02:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Loses-Value-When-Toggling-Visibility/m-p/1089665#M23683</guid>
      <dc:creator>cboneill0099</dc:creator>
      <dc:date>2020-05-14T12:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Slicer Loses Value When Toggling Visibility</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Loses-Value-When-Toggling-Visibility/m-p/1099615#M23786</link>
      <description>&lt;P&gt;I attempted to use the filtering API and it solved half of my problem.&amp;nbsp; Now, when I hide the visual the filter does not go away, but when I make the visual visable again, the filter gets lost.&amp;nbsp; Is there something I should be doing to persist the filter behind the scenes and reload it when making the visual visable again?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code in the update method:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;        let filterTarget: IFilterColumnTarget = {
            table: categories.source.queryName.substr(0, categories.source.queryName.indexOf('.')),
            column: categories.source.displayName
        };
        
        const basicFilter: IBasicFilter = {
            $schema: "http://powerbi.com/product/schema#basic",
            // target: {
            //     table:"Date",
            //     column:"CalendarYear"
            // },
            target: filterTarget,
            operator: "In",
            values: [dateSelectionValue], //[2019],
            filterType: FilterType.Basic
        }

        this.visualHost.applyJsonFilter(basicFilter, "general", "filter", FilterAction.merge);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I added to the capabilities file:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"general": {
            "displayName": "General",
            "displayNameKey": "formattingGeneral",
            "properties": {
                "filter": {
                    "type": {
                        "filter": true
                    }
                },
                "selfFilter": {
                    "type": {
                        "filter": {
                            "selfFilter": true
                        }
                    }
                }
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 23:13:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Loses-Value-When-Toggling-Visibility/m-p/1099615#M23786</guid>
      <dc:creator>cboneill0099</dc:creator>
      <dc:date>2020-05-20T23:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Slicer Loses Value When Toggling Visibility</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Loses-Value-When-Toggling-Visibility/m-p/1100973#M23796</link>
      <description>&lt;P&gt;There was an error in my code causing the filter to get lost.&amp;nbsp; The above solution worked for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 13:50:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Loses-Value-When-Toggling-Visibility/m-p/1100973#M23796</guid>
      <dc:creator>cboneill0099</dc:creator>
      <dc:date>2020-05-21T13:50:16Z</dc:date>
    </item>
  </channel>
</rss>

