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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
artlemaks
Helper II
Helper II

Setting active page of report

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.

5 REPLIES 5
Jiny
Regular Visitor

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)

v-xicai
Community Support
Community Support

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. 

collinq
Super User
Super User

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.

 

I would appreciate Kudos if my response was helpful. I would also appreciate it if you would Mark this As a Solution if it solved the problem. Thanks!

 




Did I answer your question? Mark my post as a solution!

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.  

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors