Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

getSlicerState error

I am trying to get a state from a slicer using getSlicerState but I am getting the error below:

 

TypeError: Cannot read property 'contract' of null
at e.getExploration (reportEmbed.slicer-api.min.js:1)
at e.tryGetVisualContainer (reportEmbed.slicer-api.min.js:1)
at e.<anonymous> (reportEmbed.slicer-api.min.js:1)
at reportEmbed.slicer-api.min.js:1
at Object.next (reportEmbed.slicer-api.min.js:1)
at reportEmbed.slicer-api.min.js:1
at new r (powerbiportal.dependencies.bundle.min.js:13)
at p (reportEmbed.slicer-api.min.js:1)
at e.handleSlicerRequest (reportEmbed.slicer-api.min.js:1)
at e.<anonymous> (reportEmbed.slicer-api.min.js:1)

 

This is my code:

this.report.getPages().then(pages => {
let pageActive = pages.filter(page => page.isActive)
if (pageActive[0]){
pageActive[0].getVisuals().then(function(visuals) {
console.log(visuals.filter(visual => visual.title === 'Basket'));
visual = visuals.filter(visual => visual.title === 'Basket');
visual[0].getSlicerState()
.then(state => {
console.log(state)
});
});
}
});    

  Does anyone know what this issue is?

visual[0] is a VisualDescriptor. It is supposed to work straightaway.

 

Thanks

 

Thanks!

Status: New
Comments
v-qiuyu-msft
Community Support

Hi @hvpl

 

I would suggest you create a support ticket to get help. 

 

Support Ticket.gif

 

Best Regards,
Qiuyun Yu 

ankurmundhra
New Member

Were you able to resolve it? I get this error when different level hierarchies are selected.

Piloos
Advocate I

I am experiencing the same error.  As long as you select items in your top hierarcy, it works fine.  But from the moment you select something on the second level of the hierarchy you get this error.

 

@hvpl , how did the support ticket go?

 

I am using powerbi-client 2.14.1

Piloos
Advocate I

Issue still seems to be present in powerbi-client 2.17.2

ankurmundhra
New Member

@Piloos  - We also created an MS support ticket for that but the support team couldn't resolve it and they also do not have a timeline for when it will be fixed.

As a work around our Power BI team, seperated out each slicer. So instead of 1 heirarchy slicer, we created 4 non-heirarchy slicers. We filter the lower (heirarchy) slicers based on the parent slicer selection.

 

Let me know if you need any more details.

 

Thanks!

-Ankur

Piloos
Advocate I

@ankurmundhra thanks for the reply.  It is a pity that Microsoft does not solve such basic very reproducible issues faster...