I have tableau server where multiple workbooks are published. My requirement is to create dropdown list with all workbooks name with their url. So that if I select any value from ddl then the corresponding workbook should be loaded. I am able to display individual workbooks with hardcoded values in ddl. So is it possible to get all workbooks from Tableau server?
I am very new to tableau.If there is any javascript API do let me know. Referred link: Javascript tableau API
Tried : http://myTableauServer/workbooks.xml but it is giving error."Page could not be loaded"
Code:
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);
}
}