Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter zara59

    (@zara59)

    Hi

    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?

    Thread Starter zara59

    (@zara59)

    < a href=”http://YourSiteName/View Report/”
    onclick=”location.href=this.href+’?filters=’+encodeURIComponent(JSON.stringify(relatedFilterObj));return false;”>View Report

    Thread Starter zara59

    (@zara59)

    Hi
    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&#8221;,
    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

    • This reply was modified 6 years, 2 months ago by zara59.
    • This reply was modified 6 years, 2 months ago by zara59.
Viewing 3 replies - 1 through 3 (of 3 total)