zara59
Forum Replies Created
-
Forum: Plugins
In reply to: [Power BI Embedded for WordPress] How to use filterHi
I’m reading tnum from user’s display name per code below:
var tnum= “<?php echo $current_user->display_name ?>”;In the user management admin panel, did you store userid in the user’s display name?
Forum: Plugins
In reply to: [Power BI Embedded for WordPress] How to use filter< a href=”http://YourSiteName/View Report/”
onclick=”location.href=this.href+’?filters=’+encodeURIComponent(JSON.stringify(relatedFilterObj));return false;”>View ReportForum: Plugins
In reply to: [Power BI Embedded for WordPress] How to use filterHi
I managed to do it:
In my application I get the userid of the logged in user and pass it to my power bi report to filter the results. I keep the useid in user’s display name in WordPress.I use XYZ PHP Code plugin to add php code to my pages.
I added this code to a page(using XYZ PHP Code) and create the link to view the reports on the fly:<?php
$current_user = wp_get_current_user();
?><script type=”text/javascript”>
var tnum= “<?php echo $current_user->display_name ?>”;
var relatedFilterObj = [{
$schema : “http://powerbi.com/product/schema#basic”,
target : {
table : “the table name in your dataset”,
column : “T Number”,
},
operator : “=”,
values : [tnum]}
];</script>
<b>
“<“ul”>”“<“li”>”
“<“a href=”http://YourWordpressSiteName/ReportPage/”>View Report</a”>”
“<“/li”>”“<“/ul”>”
</b>In your report page simply embed the power bi report:
[powerbi id=”id” width=”100%” height=”1080px”]Please let me know if it helps.
Zara