<?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: Filter Query String Parameter in custom Javascript Embed application in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Filter-Query-String-Parameter-in-custom-Javascript-Embed/m-p/474777#M14569</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/74013"&gt;@sierra710&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You almost get it done. Please try the online demo &lt;A href="https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html#" target="_self"&gt;here&lt;/A&gt;.&amp;nbsp; You also can get the source code &lt;A href="https://github.com/Microsoft/PowerBI-JavaScript" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;PRE&gt;// Build the filter you want to use. For more information, See Constructing
// Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters.
const filter = {
  $schema: "http://powerbi.com/product/schema#basic",
  target: {
    table: "Store",
    column: "Chain"
  },
  operator: "In",
  values: ["Lindseys"]
};

// Get a reference to the embedded report HTML element
var embedContainer = $('#embedContainer')[0];

// Get a reference to the embedded report.
report = powerbi.get(embedContainer);

// Set the filter for the report.
// Pay attention that setFilters receives an array.
report.setFilters([filter])
    .catch(function (errors) {
        Log.log(errors);
    });&lt;/PRE&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Dale&lt;/P&gt;</description>
    <pubDate>Mon, 30 Jul 2018 05:30:18 GMT</pubDate>
    <dc:creator>v-jiascu-msft</dc:creator>
    <dc:date>2018-07-30T05:30:18Z</dc:date>
    <item>
      <title>Filter Query String Parameter in custom Javascript Embed application</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Filter-Query-String-Parameter-in-custom-Javascript-Embed/m-p/473792#M14544</link>
      <description>&lt;P&gt;I am looking to build an app that passes a filter query string to a report, similar in format as the filter query string in PBI Service reports:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;URL?filter=&lt;EM&gt;&lt;STRONG&gt;Table&lt;/STRONG&gt;&lt;/EM&gt;/&lt;EM&gt;&lt;STRONG&gt;Field&lt;/STRONG&gt;&lt;/EM&gt; eq '&lt;EM&gt;&lt;STRONG&gt;value&lt;/STRONG&gt;&lt;/EM&gt;'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then convert this format to Javascript, IBasicFilter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="pl-k"&gt;const&lt;/SPAN&gt; basicFilter&lt;SPAN class="pl-k"&gt;:&lt;/SPAN&gt; &lt;SPAN class="pl-en"&gt;pbi&lt;/SPAN&gt;.&lt;SPAN class="pl-en"&gt;models&lt;/SPAN&gt;.&lt;SPAN class="pl-en"&gt;IBasicFilter&lt;/SPAN&gt; &lt;SPAN class="pl-k"&gt;=&lt;/SPAN&gt; {
&amp;nbsp;&amp;nbsp;$schema: &lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;http://powerbi.com/product/schema#basic&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;,
&amp;nbsp;&amp;nbsp;target: {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;table: &lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;Store&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;column: &lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;Count&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;},
&amp;nbsp;&amp;nbsp;operator: &lt;SPAN class="pl-s"&gt;&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;In&lt;SPAN class="pl-pds"&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;,
&amp;nbsp;&amp;nbsp;values: [&lt;SPAN class="pl-c1"&gt;1&lt;/SPAN&gt;,&lt;SPAN class="pl-c1"&gt;2&lt;/SPAN&gt;,&lt;SPAN class="pl-c1"&gt;3&lt;/SPAN&gt;,&lt;SPAN class="pl-c1"&gt;4&lt;/SPAN&gt;],
&amp;nbsp;&amp;nbsp;filterType: &lt;SPAN class="pl-smi"&gt;pbi&lt;/SPAN&gt;.&lt;SPAN class="pl-smi"&gt;models&lt;/SPAN&gt;.&lt;SPAN class="pl-smi"&gt;FilterType&lt;/SPAN&gt;.&lt;SPAN class="pl-smi"&gt;BasicFilter&lt;/SPAN&gt;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Curious if anyone has done this before, and knows of a plugin or easier way to transform this structure.&amp;nbsp; thanks&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jul 2018 12:11:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Filter-Query-String-Parameter-in-custom-Javascript-Embed/m-p/473792#M14544</guid>
      <dc:creator>sierra710</dc:creator>
      <dc:date>2018-07-27T12:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Query String Parameter in custom Javascript Embed application</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Filter-Query-String-Parameter-in-custom-Javascript-Embed/m-p/474777#M14569</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/74013"&gt;@sierra710&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You almost get it done. Please try the online demo &lt;A href="https://microsoft.github.io/PowerBI-JavaScript/demo/v2-demo/index.html#" target="_self"&gt;here&lt;/A&gt;.&amp;nbsp; You also can get the source code &lt;A href="https://github.com/Microsoft/PowerBI-JavaScript" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;PRE&gt;// Build the filter you want to use. For more information, See Constructing
// Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters.
const filter = {
  $schema: "http://powerbi.com/product/schema#basic",
  target: {
    table: "Store",
    column: "Chain"
  },
  operator: "In",
  values: ["Lindseys"]
};

// Get a reference to the embedded report HTML element
var embedContainer = $('#embedContainer')[0];

// Get a reference to the embedded report.
report = powerbi.get(embedContainer);

// Set the filter for the report.
// Pay attention that setFilters receives an array.
report.setFilters([filter])
    .catch(function (errors) {
        Log.log(errors);
    });&lt;/PRE&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Best Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: 'Segoe UI'; font-size: 10.5pt; color: #333333;"&gt;Dale&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 05:30:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Filter-Query-String-Parameter-in-custom-Javascript-Embed/m-p/474777#M14569</guid>
      <dc:creator>v-jiascu-msft</dc:creator>
      <dc:date>2018-07-30T05:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: Filter Query String Parameter in custom Javascript Embed application</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Filter-Query-String-Parameter-in-custom-Javascript-Embed/m-p/475193#M14583</link>
      <description>&lt;P&gt;Thanks, but this does not address my question.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am looking to programmatically generate the basic filter, not hard code values.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 11:49:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Filter-Query-String-Parameter-in-custom-Javascript-Embed/m-p/475193#M14583</guid>
      <dc:creator>sierra710</dc:creator>
      <dc:date>2018-07-30T11:49:03Z</dc:date>
    </item>
  </channel>
</rss>

