Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
Hi all,
I have embedded reports and paginated reports in our website. For the regular reports I set up a bookmarking system using the powerbi-client javascript library to capture and apply bookmarks. I am trying to do something similar for paginated reports. I understand that currently paginated reports are much more limited than regular reports. There is no bookmarking functionality or client-side events for embedded paginated reports, so I am trying to find another way.
I have a paginated report with about 10 drop downs and one radio button. I want to give users the ability to save their selections and reapply them. I cannot get a users selected parameters with javascript because the parameters are inside the embedded iframe and same-origin policy forbids it.
Does anyone have a solution for this? Is this feature on the roadmap to make paginated reports more feature complete like regular reports?
Is there a way to send parameter selections with the API request to get the embedded report? I am still looking for a way to do this. If I can do that, then I can probably hide all of the report parameters, and create a UI for the users to select parameters so that my application has control of all the parameters. Of course, I would rather find a simpler solution, but this is my best idea at the moment.
Thanks for your time!
EDIT: It may be helpful to know this is an embed for your customers (app owns data) scenario using an A sku and a Service Principal.
Solved! Go to Solution.
EDIT: It appears the preferred way to pass these parameters is via the parameterValues property of IPaginatedReportLoadConfiguration. However, it seems IPaginatedReportLoadConfiguration is not importable from powerbi-client...
https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/embed-paginated-report
EDIT2: IPaginatedReportLoadConfiguration is importable from powerbi-client.models.
private _paginatedReportConfig: models.IPaginatedReportLoadConfiguration = {
type: 'report',
id: '',
embedUrl: undefined,
tokenType: models.TokenType.Embed,
accessToken: '',
parameterValues: [
{ name: 'StartDate', value: '05/01/2023' },
{ name: 'EndDate', value: '05/22/2023' },
{ name: 'OtherParam', value: '86' },
],
settings: {
commands: {
parameterPanel: {
enabled: this.showParams,
},
},
},
};
ORIGINAL:
https://learn.microsoft.com/en-us/power-bi/paginated-reports/parameters/pass-report-parameter-url
I found one solution, passing parameters as query parameters in the EmbedUrl. I need to confirm that their is a way to disable the parameters section of the paginated report. I think it can be done by hiding all the params in Report Builder or maybe with a client-side option.
Below is some basic code appending 3 parameters to the EmbedUrl.
var paginatedReport = pbiClient.Reports.GetReportInGroup(workspaceId, paginatedReportId);
paginatedReport.EmbedUrl += "&rp:StartDate=05%2F01%2F2023";
paginatedReport.EmbedUrl += "&rp:EndDate=05%2F22%2F2023";
paginatedReport.EmbedUrl += "&rp:OtherParameter=99";
var tokenRequest = new GenerateTokenRequestV2(
reports: new List<GenerateTokenRequestV2Report>() { new GenerateTokenRequestV2Report(paginatedReportId) },
datasets: !string.IsNullOrEmpty(paginatedReport.DatasetId) ? new List<GenerateTokenRequestV2Dataset> { new GenerateTokenRequestV2Dataset(paginatedReport.DatasetId) } : null,
targetWorkspaces: new List<GenerateTokenRequestV2TargetWorkspace>() { new GenerateTokenRequestV2TargetWorkspace(workspaceId) },
identities: effectiveIdentities
);
pbiClient.EmbedToken.GenerateToken(tokenRequest);
EDIT: It appears the preferred way to pass these parameters is via the parameterValues property of IPaginatedReportLoadConfiguration. However, it seems IPaginatedReportLoadConfiguration is not importable from powerbi-client...
https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/embed-paginated-report
EDIT2: IPaginatedReportLoadConfiguration is importable from powerbi-client.models.
private _paginatedReportConfig: models.IPaginatedReportLoadConfiguration = {
type: 'report',
id: '',
embedUrl: undefined,
tokenType: models.TokenType.Embed,
accessToken: '',
parameterValues: [
{ name: 'StartDate', value: '05/01/2023' },
{ name: 'EndDate', value: '05/22/2023' },
{ name: 'OtherParam', value: '86' },
],
settings: {
commands: {
parameterPanel: {
enabled: this.showParams,
},
},
},
};
ORIGINAL:
https://learn.microsoft.com/en-us/power-bi/paginated-reports/parameters/pass-report-parameter-url
I found one solution, passing parameters as query parameters in the EmbedUrl. I need to confirm that their is a way to disable the parameters section of the paginated report. I think it can be done by hiding all the params in Report Builder or maybe with a client-side option.
Below is some basic code appending 3 parameters to the EmbedUrl.
var paginatedReport = pbiClient.Reports.GetReportInGroup(workspaceId, paginatedReportId);
paginatedReport.EmbedUrl += "&rp:StartDate=05%2F01%2F2023";
paginatedReport.EmbedUrl += "&rp:EndDate=05%2F22%2F2023";
paginatedReport.EmbedUrl += "&rp:OtherParameter=99";
var tokenRequest = new GenerateTokenRequestV2(
reports: new List<GenerateTokenRequestV2Report>() { new GenerateTokenRequestV2Report(paginatedReportId) },
datasets: !string.IsNullOrEmpty(paginatedReport.DatasetId) ? new List<GenerateTokenRequestV2Dataset> { new GenerateTokenRequestV2Dataset(paginatedReport.DatasetId) } : null,
targetWorkspaces: new List<GenerateTokenRequestV2TargetWorkspace>() { new GenerateTokenRequestV2TargetWorkspace(workspaceId) },
identities: effectiveIdentities
);
pbiClient.EmbedToken.GenerateToken(tokenRequest);
Check out the November 2023 Power BI update to learn about new features.
User | Count |
---|---|
7 | |
2 | |
2 | |
2 | |
2 |