Forum Discussion
Can't display a new report
- 9 years ago
Embedding a dataset to create a report works in my test. I can create and save a report. In your case, please try to debug the accesstoken used to embed a dataset and decode it at https://jwt.io/. You'll find the workspaceid, datasetid and scopes, please ensure that all information is correct and scope is "Dataset.Read Workspace.Report.Create"
var embedToken= PowerBIToken.CreateReportEmbedTokenForCreation(this.workspaceCollection, workspaceId, datasetid, null, null, "Dataset.Read Workspace.Report.Create"); AccessToken = embedToken.Generate(this.accessKey)
A static html testing demo FYI.
<html> <script src="../jquery.js"></script> <script src="../powerbi.js"></script> <script type="text/javascript"> window.onload = function () { // Read embed application token from textbox var txtAccessToken = 'accessToken'; // Read embed URL from textbox var txtEmbedUrl = 'https://embedded.powerbi.com/appTokenReportEmbed'; // Read dataset Id from textbox var txtEmbedDatasetId = 'datasetID'; // Embed create configuration used to describe the what and how to create report. // This object is used when calling powerbi.createReport. var embedCreateConfiguration = { accessToken: txtAccessToken, embedUrl: txtEmbedUrl, datasetId: txtEmbedDatasetId, }; // Grab the reference to the div HTML element that will host the report var reportContainer = $('#reportContainer')[0]; // Create report var report = powerbi.createReport(reportContainer, embedCreateConfiguration); } </script> <div id="reportContainer" ></div> </html>
Embedding a dataset to create a report works in my test. I can create and save a report. In your case, please try to debug the accesstoken used to embed a dataset and decode it at https://jwt.io/. You'll find the workspaceid, datasetid and scopes, please ensure that all information is correct and scope is "Dataset.Read Workspace.Report.Create"
var embedToken= PowerBIToken.CreateReportEmbedTokenForCreation(this.workspaceCollection, workspaceId, datasetid, null, null, "Dataset.Read Workspace.Report.Create"); AccessToken = embedToken.Generate(this.accessKey)
A static html testing demo FYI.
<html>
<script src="../jquery.js"></script>
<script src="../powerbi.js"></script>
<script type="text/javascript">
window.onload = function () {
// Read embed application token from textbox
var txtAccessToken = 'accessToken';
// Read embed URL from textbox
var txtEmbedUrl = 'https://embedded.powerbi.com/appTokenReportEmbed';
// Read dataset Id from textbox
var txtEmbedDatasetId = 'datasetID';
// Embed create configuration used to describe the what and how to create report.
// This object is used when calling powerbi.createReport.
var embedCreateConfiguration = {
accessToken: txtAccessToken,
embedUrl: txtEmbedUrl,
datasetId: txtEmbedDatasetId,
};
// Grab the reference to the div HTML element that will host the report
var reportContainer = $('#reportContainer')[0];
// Create report
var report = powerbi.createReport(reportContainer, embedCreateConfiguration);
}
</script>
<div id="reportContainer" ></div>
</html>
My token Access is false, I try to change that.
Thanks for you response.
Sarah.