Goal: Load a paginated report into webpage which has few parameters with the help of powerbi api javascript.
Paginated reportUrl: https://app.powerbi.com/groups/workspaceId/rdlreports/reportId?ctid=something&rp:CustomerID=something&rp:ContractID=something
I can load the report but could not pass the parameters - hence report is loading as blank.
UnLike powerbi report, paginated report doesn't support report.getFilters() like powerBi embedded report.
I referred these docs - but could not find any help...
https://learn.microsoft.com/en-us/power-bi/paginated-reports-parameters https://learn.microsoft.com/en-us/power-bi/developer/paginated-reports-row-level-security#passing-the-configured-parameter-using-the-embed-token https://learn.microsoft.com/en-us/power-bi/developer/embed-paginated-reports-customers
This is how I am getting a powerbi report and then embeding that in webpage:
[HttpGet]
[Route("AccessToken")]
[ProducesResponseType(StatusCodes.Status200OK)]
public async Task<ActionResult> GetEmbeddedAccessTokenAsync(string reportType)
{
Guid currentReportId = getCurrentReportId(reportType); //private method which gets the report guid
using (var client = await GetPowerBIClientAsync())
{
var report = await client.Reports.GetReportInGroupAsync(_powerBiWorkspaceId, currentReportId);
var generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: TokenAccessLevel.View);
var tokenResponse = await client.Reports.GenerateTokenInGroupAsync(_powerBiWorkspaceId, report.Id, generateTokenRequestParameters);
return new OkObjectResult(JsonSerializer.Serialize(new { EmbedUrl = report.EmbedUrl, AccessToken = tokenResponse.Token, WorkspaceId = _powerBiWorkspaceId, ReportId = report.Id, Expires = tokenResponse.Expiration }));
}
}
let token = await this.http.get(this.url + 'api/PowerBi/AccessToken?reportType=' + this.reportType, { params: {}, responseType: 'text', withCredentials: true }).toPromise();
let tokenObject = JSON.parse(token);
let reportContainer = document.getElementById('kpi-report-container');
this.powerbi.bootstrap(reportContainer, config);
let report: Report = <Report>(this.powerbi.embed(reportContainer, config));
// Report.off removes a given event handler if it exists.
report.off("loaded");
let self = this;
// Report.on will add an event handler which prints to Log window.
report.on("loaded", function () {
self.SelectedReportId(self.reportId);
report.updateSettings({
bookmarksPaneEnabled: false,
filterPaneEnabled: true
});
// Set token expiration listener
self.SetTokenExpirationListener(tokenObject.Expires,
2, /*minutes before expiration*/
tokenObject.ReportId,
tokenObject.WorkspaceId);
});