我有使用多个工作簿发布的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);
}
}
答案 0 :(得分:1)
您将需要使用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