Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
I have 4 pages in my report. I need to display different page based on the website that the customer is currently viewing. Originally, I had 4 different configurations which was loading the report 4 times. Of course, that had a huge effect on the performance and simply isn't the right solution.
At first, I have tried this
var report = powerbi.embed($reportContainer.get(0), embedConfigurationMain);
report.setFilters([basicFilterMain, stocktakeIdFilterMain]);
var page = report.page('ReportSectionxxxxxxxxx');
page.setActive();
But it still displays the default page of the report.
I then found someone with a similar problem here https://community.powerbi.com/t5/Developer/set-active-page-in-report-with-JavaScript-API/m-p/93716#M... and tried the suggested solution, but I am getting the following error:
Uncaught TypeError: Cannot read property 'setActive' of undefined
What is the proper way of setting the active report page in JavaScript API? I am using to most recent version of Power BI Embedded SDK.
Thanks.
Resolution: (with the latest features in version 3.1.0 as of July 2023)
To set the input page as active
set_active_page(page_name)
Arguments:
page_name (string): name of the page you want to set as active
Usage:
report.set_active_page(page_name)
Hi @artlemaks ,
You may refer to the link: https://stackoverflow.com/questions/63281233/setting-active-page-in-power-bi-report .
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-xicai the linked website is my post. Suggested solution would not work for me as I am using Power BI embedded and not using the report link anywhere. I am only using report ID in the JavaScript API.
Hi @artlemaks ,,
Perhaps this link will help: https://stackoverflow.com/questions/42774398/how-to-set-default-page-in-power-bi-embedded-report#:~:...
Let me know if that helps.
Proud to be a Datanaut!
Private message me for consulting or training needs.
@collinq I found this link as well. The first suggested solution with using pageName in config - that was my initial route. But then I ended up with 4 configurations which means that the report was loaded 4 times and as mentioned in my initial post - that has really affected the performance of the website.
With the 2nd solution
report.setPage("page2")
.catch(error => { ... });
I have tried that as well and the report doesn't react to it either. I have a call scheduled with Power BI support later on today so I will update my post after.