<?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: SetSlicerState throws Strange Error in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/SetSlicerState-throws-Strange-Error/m-p/672754#M19163</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try &lt;A href="https://stackoverflow.com/questions/30715367/why-can-i-not-throw-inside-a-promise-catch-handler" target="_self"&gt;this trick&lt;/A&gt;, may be it will help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Evgenii Elkin,&lt;BR /&gt;Software Engineer&lt;BR /&gt;Microsoft Power BI Custom Visuals&lt;BR /&gt;pbicvsupport@microsoft.com&lt;/P&gt;</description>
    <pubDate>Thu, 18 Apr 2019 07:01:17 GMT</pubDate>
    <dc:creator>v-evelk</dc:creator>
    <dc:date>2019-04-18T07:01:17Z</dc:date>
    <item>
      <title>SetSlicerState throws Strange Error</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/SetSlicerState-throws-Strange-Error/m-p/669065#M19146</link>
      <description>&lt;P&gt;I'm still trying to set up a minimal repro, but- When I try to set a slicerState on an embedded PowerBI report, using the below code, I get the below error. So far as I can tell, nothing of mine calls that code, and the catch blocks don't fire. This is just appearing from the aether. What, if anything, can I do about this, and where should I start troubleshooting? I've tried myself, but it's a minified file, so the undefined variable is just called `n`, and it's in an anonymous function inside another function just called `e`. Troubleshooting minified code has got to be one of the circles of Hell.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;PRE&gt; const filter = {
      '$schema': 'http://powerbi.com/product/schema#basic',
      'target': {
        'table': 'Main_chart',
        'column': 'Date'
      },
      'filterType': 1,
      'operator': 'In',
      'values': ['2019-01-18T08:00:00.000Z']
    };
    this.component.getPages()
      .then(function (pages) {

        // Retrieve active page.
        var activePage = pages.filter(function (page) {
          return page.isActive
        })[0];

        activePage.getVisuals()
          .then(function (visuals) {

            // Retrieve the wanted visual.
            var visual = visuals.filter(item =&amp;gt; item.type === 'slicer')[0];

            visual.setSlicerState(filter)
              .then(function () {
                console.log(`Filter was set for "Category Breakdown" table.${filter}`);
              })
              .catch(function (errors) {
                console.log(`Unable to set filter ${JSON.stringify(filter)}: ${JSON.stringify(errors)}`);
                visual.setSlicerState(filter)
              });
          })
          .catch(function (errors) {
            console.log(`Unable to get visual: ${errors}`);
          });
      })
      .catch(function (errors) {
        console.log(`Unable to get page: ${errors}`);
      });&lt;/PRE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 19:56:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/SetSlicerState-throws-Strange-Error/m-p/669065#M19146</guid>
      <dc:creator>darthbob88</dc:creator>
      <dc:date>2019-04-12T19:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: SetSlicerState throws Strange Error</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/SetSlicerState-throws-Strange-Error/m-p/672083#M19156</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because I don't see any information is logged into console before the error happens and I see that the error is related with "length" I can propose that the error happens before log messages and it is probably somewhere here&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; // Retrieve the wanted visual.
 var visual = visuals.filter(item =&amp;gt; item.type === 'slicer')[0];&lt;/PRE&gt;&lt;P&gt;But I am not sure, please check this moment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Evgenii Elkin,&lt;BR /&gt;Software Engineer&lt;BR /&gt;Microsoft Power BI Custom Visuals&lt;BR /&gt;pbicvsupport@microsoft.com&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 12:41:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/SetSlicerState-throws-Strange-Error/m-p/672083#M19156</guid>
      <dc:creator>v-evelk</dc:creator>
      <dc:date>2019-04-17T12:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: SetSlicerState throws Strange Error</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/SetSlicerState-throws-Strange-Error/m-p/672360#M19159</link>
      <description>&lt;P&gt;Hey Evgenii, thanks for the response. That's not it. That code does get the right slicer, and if I step into &lt;SPAN&gt;visual.&lt;/SPAN&gt;&lt;SPAN&gt;setSlicerState&lt;/SPAN&gt;&lt;SPAN&gt;(filter) it seems to work well there, but a breakpoint on the throw doesn't catch anything.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;VisualDescriptor.prototype.setSlicerState = function (state) {
return this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", state, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)
.catch(function (response) {
throw response.body;
});
};&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've moved back to using just a filter as a parameter rather than the slicer here, so this isn't a priority, but it's still baffling.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 17:55:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/SetSlicerState-throws-Strange-Error/m-p/672360#M19159</guid>
      <dc:creator>darthbob88</dc:creator>
      <dc:date>2019-04-17T17:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: SetSlicerState throws Strange Error</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/SetSlicerState-throws-Strange-Error/m-p/672754#M19163</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try &lt;A href="https://stackoverflow.com/questions/30715367/why-can-i-not-throw-inside-a-promise-catch-handler" target="_self"&gt;this trick&lt;/A&gt;, may be it will help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Evgenii Elkin,&lt;BR /&gt;Software Engineer&lt;BR /&gt;Microsoft Power BI Custom Visuals&lt;BR /&gt;pbicvsupport@microsoft.com&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 07:01:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/SetSlicerState-throws-Strange-Error/m-p/672754#M19163</guid>
      <dc:creator>v-evelk</dc:creator>
      <dc:date>2019-04-18T07:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: SetSlicerState throws Strange Error</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/SetSlicerState-throws-Strange-Error/m-p/673493#M19168</link>
      <description>&lt;P&gt;I think it might work, but I'd have to put the extra catch in powerbi.js, which is a library that I don't own. I'll mark that as a tentative solution and move on elsewhere.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2019 22:05:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/SetSlicerState-throws-Strange-Error/m-p/673493#M19168</guid>
      <dc:creator>darthbob88</dc:creator>
      <dc:date>2019-04-18T22:05:17Z</dc:date>
    </item>
  </channel>
</rss>

