Report filter scripting operations
- Last UpdatedJul 18, 2024
- 2 minute read
The Power BI App includes methods to clear or modify filtering at the report and page levels by layout scripts.
ClearReportFilters
This ClearReportFilters method removes all filters at the Power BI report level.
Mycontent.PBIViewerCntrl.ClearReportFilters();
ClearPageFilters
The ClearPageFilters method removes all filters at the specified page in the Power BI report.
MyContent.PBIViewerCntrl.ClearPageFilters("ReportPage1");
FullScreen
The FullScreen method shows the Power BI report in full screen mode. While a ViewApp is running, the Power BI App must have focus when calling the FullScreen method. Press the Esc key or invoke the ExitFullScreen () method to exit from full screen mode.
FullScreen() requires an accompanying user gesture to expand the screen and cannot be called only by script, FullScreen() in a script needs to be initiated by a user gesture such as a mouse click or a pressed key event.
MyContent.PBIViewerCntrl.FullScreen();
ExitFullScreen
The ExitFullScreen method returns a Power BI report shown in fullscreen mode to the normal Power BI report size shown in a ViewApp pane.
MyContent.PBIViewerCntrl.ExitFullScreen();
Refresh
This method refreshes the underlined data of an embedded report without resetting the current filters or user interactions.
MyContent.PBIViewerCntrl.Refresh();
Render
This method re-renders the embedded report without reloading the web page. It resets the current filters and user interactions to return the embedded Power BI report back to its original state
MyContent.PBIViewerCntrl.Render();
Reload
This method reloads the embedded report and resets the current filters and user interactions. The Power BI report returns to its original state. For example, in a report this effectively clears all the new filters originally saved and makes the page the report was saved on as active, resetting a report back to its original state.
MyContent.PBIViewerCntrl.Reload();