Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
Hi
I use the ExportTo API to export reports to PDF
This works correctly, but I'd like to also export the filters the user applies to the embedded report.
To do this, I capture the state:
async function CaptureFilters() {
var filter = await report.bookmarksManager.capture();
return filter.state;
}
And I pass it to the API as a property:
"defaultBookmark": {
"state": "xxx"
}
This works correctly if the user sets filters on all pages
If the user sets filters for a single page and then moves to another page and launches the export, the filters for that page aren't captured, but only the ones where they're currently positioned
How can I fix this?
Thanks
Solved! Go to Solution.
Hi @DavideBono97,
In Power BI Embedded, the bookmarksManager.capture() function captures only the current report state for the active page. This means that when exporting, only filters from the page the user is viewing are included. If filters are applied on another page and the user navigates away, those filters will not be captured unless they are part of the report-level state.
To solve this, apply filters at the report level rather than the page level before capturing the bookmark state. You can use the Power BI JavaScript API, such as report.getFilters() and page.getFilters(), to retrieve all active filters, combine them, and then apply them as report-level filters with report.setFilters(). Afterward, call bookmarksManager.capture(). This ensures the captured state, when sent to the ExportTo API via defaultBookmark.state, includes the full filter context across all pages. Alternatively, you can navigate to each page, capture its state, and merge the filters before exporting. This approach ensures the exported PDF includes all user-applied filters from the entire report, not just the active page.
Thank you
Hi @DavideBono97,
In Power BI Embedded, the bookmarksManager.capture() function captures only the current report state for the active page. This means that when exporting, only filters from the page the user is viewing are included. If filters are applied on another page and the user navigates away, those filters will not be captured unless they are part of the report-level state.
To solve this, apply filters at the report level rather than the page level before capturing the bookmark state. You can use the Power BI JavaScript API, such as report.getFilters() and page.getFilters(), to retrieve all active filters, combine them, and then apply them as report-level filters with report.setFilters(). Afterward, call bookmarksManager.capture(). This ensures the captured state, when sent to the ExportTo API via defaultBookmark.state, includes the full filter context across all pages. Alternatively, you can navigate to each page, capture its state, and merge the filters before exporting. This approach ensures the exported PDF includes all user-applied filters from the entire report, not just the active page.
Thank you
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |