I've been working in the JavaScript API Tutorial that tableau provides.
The filter option works well on the Region filter, but for some reason stalls out on the "Year" filter. Here's my code:
var viz;
var workbook;
// Initialize the javascript controls for Tableau
window.onload=function() {
var vizDiv = document.getElementById('viz');
var vizURL = 'http://public.tableau.com/views/WorldIndicators/GDPpercapita';
var options = {
width: '600px',
height: '540px',
hideToolbar: true,
hideTabs: true,
onFirstInteractive: function() {
document.getElementById('sheetName').innerHTML=viz.getWorkbook().getActiveSheet().getName();
}
}
viz = new tableauSoftware.Viz(vizDiv,vizURL, options);
};
// Filter By Years
function addValuesToFilter() {
activeSheet = viz.getWorkbook().getActiveSheet();
activeSheet.applyFilterAsync(
"Year",
["2002", "2003"],
tableau.FilterUpdateType.ADD);
}
// WORKING Filter Region
function addValuesToFilter() {
activeSheet = viz.getWorkbook().getActiveSheet();
activeSheet.applyFilterAsync(
"Region",
["Europe", "The Americas"],
tableau.FilterUpdateType.ADD);
}
So I figure there must be some kid of 'getProperty' function to dump out the column names or something, but the API is pretty scant, and I'm not that great of a programmer. I've taken a look into the .twb file's xml but it's mostly mumbo-jumbo and it's hard to make head or tail of what's going on in there.
Where am I going wrong here? Is there a place I can get a list of filter names, or are date filters perhaps handled differently in Tableau?
[2002, 2003](lose the quotes) - WhiteHat