Passing field into Code Page -

  • 0
  • 1
  • Question
  • Updated 6 months ago
  • Answered
I'm trying to embed an iframe using IOL-- I'm able to embed the page I want but I'm not able to pass my qbase field (var state = $("catformula", xml).text();)   -- into the url below.....

I'm sure the issue is how I'm coding the "filtering" part of my URL --- &$filter=Accounts/Category eq 'qbasefield' 

Any help is greatly appreciated.....the code I'm using is listed below.


(function(){
  var querystring=document.location.search;

  if(/a=dr/i.test(querystring)) {
    //DISPLAY RECORD PAGE
    $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");

    var apptoken = "dwnxji38j";
    $.ajaxSetup({data: {apptoken: apptoken}});
    var dbidAccounts = "bjec5";

    var promise = $.get(dbidAccounts, {
      act: "API_DoQuery",
      query: "{3.EX." + kRid + "}",
      clist: "21"
    });
    $.when(promise).then(function(xml) {
      var state = $("catformula", xml).text();

      var url = "";
      url += "https://app.powerbi.com/reportEmbed?reportId=802c3595-add7-4a48-aa725ea0&groupId=178e260d-ca8b-4...;
      url += "&$filter=\"Accounts%2FCategory\"eq'" + state + "'";   

      $("<iframe></iframe>")
        .attr("frameborder", "0")
        .attr("width", "100%")
        .attr("height", "450")
        .attr("src", url)
        .insertAfter("#sect_s14");
    }); 
 
  }
})();

Photo of rocketc

rocketc

  • 824 Points 500 badge 2x thumb

Posted 6 months ago

  • 0
  • 1
Photo of rocketc

rocketc

  • 824 Points 500 badge 2x thumb
I got this working
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,204 Points 20k badge 2x thumb
Yes the benefit from using the "inline script" or 3Q&S Technique is that (1) it is self contained and requires no other setup other the the Rich Text Formula field and (2) you don't have to make reference to a section id as the formula field itself can be used as the target:

.insertAfter("#sect_s14");

But what did you do with the $filter parameter? PowerBI has docs both with and without the dollar sign.

> how else can inline scripts be leveraged

Once you get JavaScript loaded - and to some extent it does not matter how you do it - you can do just about anything.
(Edited)
Photo of rocketc

rocketc

  • 824 Points 500 badge 2x thumb
Dan,

I created a URL formula field --- inserted the embedded URL from PowerBI below --- and inserted my "filter field" - [state] -- I may have broken many coding rules -- but it works...

URL Formula
"http..app.powerbi.com/reportEmbed?reportId=802c359548-aaa8-b910f9725ea0&groupId=178e0-41741f6a5853&autoAuth=true&pageName=ReportSection&$filter=Accounts%2FCategory%20eq%20%27"&URLEncode([State])&"%27" 
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,204 Points 20k badge 2x thumb
Yes I go that but PowerBI in their docs makes reference to using both filter= and $filter=

?filter=Store/Territory eq 'NC'

https://docs.microsoft.com/en-us/power-bi/service-url-filters

Does it take both or is one of these a typo?

This seems like a viable way to bring PowerBI into QuickBase so I myself want to understand their API better.
(Edited)
Photo of rocketc

rocketc

  • 824 Points 500 badge 2x thumb
Dan,

The difference may be with the embedding method -- the method I'm using -- is a new method called "Secure Embed" vs Publish to web method. I'm not sure why the difference -- but i just replaced the $ with a ? and it did not work ---

Secure Embed and the nonsecure (publish to web) methods are both apart of the Power BI service -- the Secure Embed functionality requires a Pro license ($10/month) -- Publish to web does not require Pro -- you can use the Free version. The secure embed option has to be generated on the Power BI service vs Power BI desktop -- there is also the developer embedding --- requires enterprise license -- the Pro version is a great option for small business...and low coders like myself...

Secure Embed  (blog article)

Secure Embed (help docs)
Photo of rocketc

rocketc

  • 824 Points 500 badge 2x thumb
Dan,

? - is used if you want to filter a report --- (share a filtered link) -- takes you to a report on the Power BI service.

$ - is used for Secure Embedding -- 

Both are hosted on the Power BI service -- ($ - for embedding)  & (?-non embedded)