我有发布多个工作簿的 tableau 服务器。 我的要求是创建包含所有工作簿名称及其 URL 的下拉列表。因此,如果我从 ddl 中选择任何值,则应加载相应的工作簿。我能够在 ddl 中显示带有硬编码值的单个工作簿。 那么是否可以从 Tableau 服务器获取所有工作簿?
我是 tableau 的新手。如果有任何 javascript API,请告诉我。 引用链接:Javascript tableau API
尝试过:http://myTableauServer/workbooks.xml但它给出了错误。“无法加载页面”
代码:
displayWorkbook(): void {
let placeholderDiv = document.getElementById("tableauViz");
let positionInfo = placeholderDiv.getBoundingClientRect();
let getUrl = this.workbookType.find(x => x.name.trim() === this.selectedWorkeBook.trim());
if (getUrl) {
let url = getUrl.value;
let options = {
width: positionInfo.width,
height: positionInfo.height,
hideTabs: true,
hideToolbar: true,
onFirstInteractive: function () {
var dash = this.tableauViz.getWorkbook().getActiveSheet();//gives only worksheet under the selected url
if(dash.getSheetType() === 'dashboard') {
var sheets = dash.getWorksheets();
for(var j=0; j<sheets.length; j++) {
this.SheetNameList.push({name : sheets.getName(),value:sheets.getUrl()});
}
}
}
}
};
if (this.tableauViz) { // If a viz object exists, delete it.
this.tableauViz.dispose();
}
this.tableauViz = new tableau.Viz(placeholderDiv, url, options);
}
}
最佳答案
您需要使用 Tableau Server REST API https://onlinehelp.tableau.com/current/api/rest_api/en-us/help.htm#REST/rest_api.htm
通过以下 Python 库哪个更容易使用 https://github.com/tableau/server-client-python
关于javascript - 从服务器获取所有画面工作簿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48638165/