Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
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 => 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}`); });
Solved! Go to Solution.
Hi,
Try this trick, may be it will help.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com
Hello,
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
// Retrieve the wanted visual. var visual = visuals.filter(item => item.type === 'slicer')[0];
But I am not sure, please check this moment.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com
Hey Evgenii, thanks for the response. That's not it. That code does get the right slicer, and if I step into visual.setSlicerState(filter) it seems to work well there, but a breakpoint on the throw doesn't catch anything.
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; }); };
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.
Hi,
Try this trick, may be it will help.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
2 | |
2 | |
1 | |
1 |