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!

setSlicerState javascript method does not work

To see the error, just use the Power BI embedded demo site and try to set slicer filters.  Javascript error below. It didn't work most of last week, but then was working Friday.  Now doesn't work again.  I had posted in Developer forum, just re-posting in Issues area.

 

Capture.PNG

Status: New
Comments
v-qiuyu-msft
Community Support

Hi @tval,

 

Based on my test, we can workaround the issue by selecting any value in Manufacturer/Product/Region slicer then deselecting the value, run Set Slicer State code in sample report. 

 

I will confirm if it's the same issue as listed in Support site. Will update here once I get any information. 

 

q2.PNG

 

Best Regards,
Qiuyun Yu 

v-qiuyu-msft
Community Support

Hi @tval,

 

I confirmed that this issue has the same root cause as the one listed in Support site. You can keep an eye on the status of the issue on Support site. 

 

Best Regards,
Qiuyun Yu 

v-qiuyu-msft
Community Support

Hi @tval,

 

Please note that there are few workarounds available. Here are two of them:

  • Users can pass empty filters array in load config. this will solve the issue.
  • Users can call GetSlicerState on one slicer which is set. this will solve the issue as well.

Best Regards,
Qiuyun Yu 

Oulak
Frequent Visitor

I came across an issue of my own while using setSlicerState:

 

ERROR Error: Uncaught (in promise): Object: {"message":"visualConfigIsNotInitialized","detailedMessage":"Visual container config is not initialized"}

 

I tried sending an empty filter array at report launch and calling getSlicerState as well; with no luck.

getSLicerState throws me the very same error as setSlicerState.

 

I'm getting the correct slicer visual (visual.type gets me 'slicer' result) through a cascade of 

report.getPages() -> page.getVisuals()

 

Any idea on what might cause this behavior ?

 

Kind regards,

Anonymous
Not applicable
At least temporarily this fixed the issue for me. Basically on the first set if it fails it tries again. I only got the error always on the first try so after that it works.
 
visual.setSlicerState({
     filters: [basicFilter]
}).catch(err => {
     visual.setSlicerState({
          filters: [basicFilter]
     });
});
 
dgpshiva
New Member

Any update on this? visual.getSlicerState() still seems to be throwing that error. None of the workarounds seem to work.