<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: API and Javascript filtering in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/API-and-Javascript-filtering/m-p/797026#M20840</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Sorry, Can you teach me how do you generate the Access Token and Refresh Token? i have many problems with this.&amp;nbsp;&lt;img id="smileymad" class="emoticon emoticon-smileymad" src="https://community.fabric.microsoft.com/i/smilies/16x16_smiley-mad.png" alt="Smiley Mad" title="Smiley Mad" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 19 Sep 2019 12:47:47 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-09-19T12:47:47Z</dc:date>
    <item>
      <title>API and Javascript filtering</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-and-Javascript-filtering/m-p/792592#M20772</link>
      <description>&lt;P&gt;We have an ASP.Net website that displays a powerBI report via “user owns data”…we have a local SQL Server using the On Premise Gateway and "Import Reports, not an Azure database.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the C# file we send a System.Net.HttpWebRequest with our access token that we deserialize with “JsonConvert”.&lt;/P&gt;&lt;P&gt;That returns report id, report name, report webUrl and report embedUrl. We store the access token, the report id and the embedUrl in aspx hidden fields.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Our report displays fine on the aspx page but the filters aren’t applied.&lt;/P&gt;&lt;P&gt;We have tried with reports where there are defined "Report Filters" in the report thata re either populated or set to "All".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have tried basic and advanced filters with no joy based on &lt;A href="https://community.powerbi.com/t5/Developer/Addling-filter-using-javascript-API-Power-BI-Service/td-p/133926" target="_blank"&gt;https://community.powerbi.com/t5/Developer/Addling-filter-using-javascript-API-Power-BI-Service/td-p/133926&lt;/A&gt; and &lt;A href="https://microsoft.github.io/PowerBI-JavaScript/demo/defaults.html" target="_blank"&gt;https://microsoft.github.io/PowerBI-JavaScript/demo/defaults.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;script src="scripts/powerbi.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src="scripts/jquery-1.12.4.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript"&amp;gt;
var report = null;

window.onload = function () { 
                var accessToken = document.getElementById('hfAccessToken').value;

                if (!accessToken || accessToken == "") {
                                return;
                }
                
                var metricFilter = {
                                $schema: "http://powerbi.com/product/schema#basic",
                                target: {
                                                table: "Cats",
                                                column: "CatName"
                                },
                                operator: "In",
                                values: ["Mr Furball"]
                }
                var embedUrl = document.getElementById('hfEmbedUrl').value;
                var reportId = document.getElementById('hfReportId').value;

                var config = {
                                type: 'report', 
                                accessToken: accessToken,
                                embedUrl: embedUrl,
                                filters: [metricFilter],
                                id: reportId,
                                settings: {
                                                filterPaneEnabled: false,
                                                navContentPaneEnabled: false
                                }
                };
                var reportContainer = document.getElementById('reportContainer');
                report = powerbi.embed(reportContainer, config); 
};
&amp;lt;/script&amp;gt;

&amp;lt;asp:HiddenField ID="hfEmbedUrl" runat="server" /&amp;gt;    
&amp;lt;asp:HiddenField ID="hfReportId" runat="server" /&amp;gt;
&amp;lt;asp:HiddenField ID="hfAccessToken" runat="server" /&amp;gt; 

&amp;lt;div class="divDashboardContainer" id="reportContainer"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;&lt;/PRE&gt;&lt;P&gt;Can anyone shed any light on why the javascript may not applying the filters ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Sep 2019 11:57:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-and-Javascript-filtering/m-p/792592#M20772</guid>
      <dc:creator>shaunwilks</dc:creator>
      <dc:date>2019-09-15T11:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: API and Javascript filtering</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-and-Javascript-filtering/m-p/796333#M20824</link>
      <description>&lt;P&gt;Anyone with some thoughts ?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2019 23:27:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-and-Javascript-filtering/m-p/796333#M20824</guid>
      <dc:creator>shaunwilks</dc:creator>
      <dc:date>2019-09-18T23:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: API and Javascript filtering</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-and-Javascript-filtering/m-p/797026#M20840</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Sorry, Can you teach me how do you generate the Access Token and Refresh Token? i have many problems with this.&amp;nbsp;&lt;img id="smileymad" class="emoticon emoticon-smileymad" src="https://community.fabric.microsoft.com/i/smilies/16x16_smiley-mad.png" alt="Smiley Mad" title="Smiley Mad" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 12:47:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-and-Javascript-filtering/m-p/797026#M20840</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-19T12:47:47Z</dc:date>
    </item>
  </channel>
</rss>

