# tableau Api Tableau JavaScript API (js_api) - Full Documentation [Skip to main content](#main-content) # About Tableau Help ## Addressing Implicit Bias in Technical Language In an effort to align with one of our core company values, equality, we have changed terminology to be more inclusive where possible. Because changing terms in code can break current implementations, we maintain the current terminology in the following places: - Tableau APIs: methods, parameters, and variables - Tableau CLIs: commands and options - Installers, installation directories, and terms in configuration files - (Undefined variable: Variables.PT\_server\_long) (we plan to make changes to non-inclusive terminology in the web interface, error messages, and related documentation soon.) - Third-party systems documentation For more information about our ongoing effort to address implicit bias, see [Salesforce Updates Technical Language in Ongoing Effort to Address Implicit Bias](https://www.salesforce.com/news/stories/salesforce-updates-technical-language-in-ongoing-effort-to-address-implicit-bias/) on the Salesforce website. [Skip to main content](#main-content) # API Reference **Important changes for the Tableau JavaScript API** As of February 2024, the Tableau JavaScript API is deprecated. Use the Embedding API v3 instead for embedding interactive views into web pages and applications. For guidance on embedding Tableau views, see the [Tableau Embedding API v3 Help](https://help.tableau.com/current/api/embedding_api/en-us/index.html). This section describes classes and methods of the Tableau JavaScript API. The JavaScript API files are located on the server (including Tableau Cloud and Tableau Public). There is no separate download. To use the JavaScript API, you just specify the URL to the JavaScript API file in your web page. For more information, see [Access the API](https://help.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_concepts_get_API.htm). ## Style and Conventions Tableau's JavaScript API follows these JavaScript standards for formatting names: - **Classes** use PascalCase (initial capital letter, with each subsequent word capitalized). - **Namespaces, methods, parameters, and variables** use camelCase (initial lower-case letter, with each subsequent word capitalized). - **Constants and enum values** use UPPERCASE; multi-word names use UPPERCASE\_UNDERSCORE\_DELIMITED. - **Protected variables or method** start with an initial underscore ( \_ ) character, indicating that it should not be referenced by the programmer. Tableau does not provide support for programs that customers create that use the Tableau JavaScript API. For help with your code, submit questions and ask for help on the Tableau developer community forums. Tableau does provide support for potential bugs in the Tableau JavaScript API code itself, and for unmodified sample code that isn't working. ## Top-Level Class Diagram The following class diagram shows the relationships between the top-level classes, as well as the inheritance hierarchy for the `Sheet`, `Dashboard`, `Story` and `Worksheet` classes. Note that there's always a way to traverse back up the containment hierarchy with parent pointers. The exception of `VizManager`, because that's a static class and always accessible.  ## Asynchronous and Error Classes ### Promise Class Represents a promise to return a value from an asynchronous method in the future. The Tableau JavaScript API implements the [Promises/A](http://wiki.commonjs.org/wiki/Promises/A) specification. #### Methods
|
Name |
Return Type |
Description |
|
then(callback: Function, errback: Function) |
Promise |
Creates a link in the asynchronous callable chain. The |
|
always(callback: Function) |
Promise |
Registers a callback that will be called when a promise is resolved or rejected. Shortcut for |
| otherwise(errback: Function) | Promise | Registers a rejection handler. Shortcut for then(null, errback). |
|
Name |
Type |
Description |
|
tableauSoftwareErrorCode |
ErrorCode |
Represents an |
|
message |
string |
This is already defined on the standard Error object, but the message will contain a description of the exception that the API code specifies. |
|
Name |
Value |
Description |
|
BROWSER_NOT_CAPABLE |
browserNotCapable |
The browser is not capable of supporting the Tableau JavaScript API. |
|
DOWNLOAD_WORKBOOK_ NOT_ALLOWED |
downloadWorkbookNotAllowed |
The permissions on a workbook or a view do not allow downloading the workbook. |
|
FILTER_CANNOT_BE_ PERFORMED |
filterCannotBePerformed |
An error occurred while attempting to perform a filter operation. |
|
INDEX_OUT_OF_RANGE |
indexOutOfRange |
Attempted to switch to a sheet by index that does not exist in the workbook. |
|
INTERNAL_ERROR |
internalError |
An error occurred within the Tableau JavaScript API. Contact Tableau Support. |
| INVALID_AGGREGATION_ FIELD_NAME | invalidAggregationFieldName | An invalid aggregation was specified for the filter, such as setting a range filter to "SUM(Sales)" instead of "Sales". |
|
INVALID_CUSTOM_VIEW_ NAME |
invalidCustomViewName |
An operation was attempted on a custom view that does not exist. |
|
INVALID_DATE_PARAMETER |
invalidDateParameter |
An invalid date was specified in a method that required a date parameter. |
|
INVALID_FILTER_ FIELDNAME |
invalidFilterFieldName |
A filter operation was attempted on a field that does not exist in the data source. |
|
INVALID_FILTER_ FIELDNAME_OR_VALUE |
invalidFilterFieldNameOrValue |
Either a filter operation was attempted on a field that does not exist in the data source, or the value supplied in the filter operation is the wrong data type or format. |
|
INVALID_FILTER_ FIELDVALUE |
invalidFilterFieldValue |
A filter operation was attempted using a value that is the wrong data type or format. |
|
INVALID_PARAMETER |
invalidParameter |
A parameter is not the correct data type or format. The name of the parameter is specified in the |
|
INVALID_SELECTION_DATE |
invalidSelectionDate |
An invalid date value was specified in a |
|
INVALID_SELECTION_ FIELDNAME |
invalidSelectionFieldName |
A field was specified in a |
|
INVALID_SELECTION_VALUE |
invalidSelectionValue |
An invalid value was specified in a |
|
INVALID_SIZE |
invalidSize |
A negative size was specified or the maxSize value is less than minSize in |
|
INVALID_SIZE_BEHAVIOR_ ON_WORKSHEET |
invalidSizeBehaviorOnWorksheet |
A behavior other than |
|
INVALID_URL |
invalidUrl |
The URL specified in the |
|
MISSING_MAX_SIZE |
missingMaxSize |
The |
|
MISSING_MIN_SIZE |
missingMinSize |
The |
|
MISSING_MINMAX_SIZE |
missingMinMaxSize |
Either or both of the |
|
MISSING_RANGEN_FOR_ RELATIVE_DATE_FILTERS |
missingRangeNForRelativeDateFilters |
The |
|
NO_URL_FOR_HIDDEN_ WORKSHEET |
noUrlForHiddenWorksheet |
An attempt was made to access |
|
NO_URL_OR_PARENT_ ELEMENT_NOT_FOUND |
noUrlOrParentElementNotFound |
One or both of the |
|
NOT_ACTIVE_SHEET |
notActiveSheet |
An operation was attempted on a sheet that is not active or embedded within the active dashboard. |
|
NULL_OR_EMPTY_ PARAMETER |
nullOrEmptyParameter |
A required parameter was not specified, null, or an empty string/array. |
|
SERVER_ERROR |
serverError |
A general-purpose server error occurred. Details are contained in the |
|
SHEET_NOT_IN_WORKBOOK |
sheetNotInWorkbook |
An operation was attempted on a sheet that does not exist in the workbook. |
|
STALE_DATA_REFERENCE |
staleDataReference |
An operation is performed on a |
|
UNSUPPORTED_EVENT_ NAME |
unsupportedEventName |
An unknown event name was specified in the call to |
|
VIZ_ALREADY_IN_MANAGER |
vizAlreadyInManager |
A |
|
Name |
Type |
Description |
|
getVizs() |
Viz[] |
Collection of views on the hosting page. |
|
Signature |
Description |
|
Viz(parentElement: domNode, url: string, options: VizCreateOptions) |
Creates a new Tableau |
|
Name |
Type |
Description |
|
getAreTabsHidden() |
bool |
Indicates whether the tabs are displayed in the UI. It does not actually hide individual tabs. |
|
getIsToolbarHidden() |
bool |
Indicates whether the toolbar is displayed. |
|
getIsHidden() |
bool |
Indicates whether the visualization is displayed on the hosting page. |
|
getParentElement() |
domNode |
Returns the node that was specified in the constructor. |
|
getUrl() |
string |
The URL of the visualization, as specified in the constructor |
|
getWorkbook() |
Workbook |
One |
|
getAreAutomaticUpdatesPaused() |
bool |
Indicates whether automatic updates are currently paused. |
|
Name |
Return Type |
Description |
|
addEventListener(
|
None |
Adds an event listener to the specified event. |
|
removeEventListener( |
None |
Removes an event listener from the specified event. |
|
Name |
Type |
Description |
|
show() |
None |
Shows or hides the |
|
dispose() |
None |
Cleans up any resources associated with the visualization, removes the visualization from the |
|
pauseAutomaticUpdatesAsync() |
None |
Pauses or resumes layout updates. This is useful if you are resizing the visualization or performing multiple calls that could affect the layout. |
|
revertAllAsync() |
None |
Equivalent to clicking on the Revert All toolbar button, which restores the workbook to its starting state. |
|
refreshDataAsync () |
None |
Equivalent to clicking on the Refresh Data toolbar button. |
| showDownloadDialog() | None | Equivalent to clicking on Download from the toolbar, which shows the Download dialog box allowing the user to select the type of download. |
|
showDownloadWorkbookDialog() |
None |
Equivalent to clicking on Download > Tableau Workbook from the toolbar, which downloads a copy of the original workbook. |
|
showExportImageDialog() |
None |
Equivalent to clicking on Download > Image from the toolbar, which creates a PNG file of the current visualization. |
|
showExportPDFDialog() |
None |
Equivalent to clicking on Download > PDF from the toolbar, which shows a dialog allowing the user to select options for downloading a PDF file. |
| showExportPowerPointDialog() | None |
Equivalent to clicking on Download > PowerPoint from the toolbar, which shows a dialog allowing the user to choose the sheets from the workbook or dashboard to download in a PowerPoint file. |
| showExportDataDialog( worksheetInDashboard: Sheet or SheetInfo or string) | None | Shows the Export Data dialog, which is currently a popup window. The worksheetInDashboard parameter is optional. If not specified, the currently active Worksheet is used. If there is no currently active Worksheet, the method throws an exception. |
| showExportCrossTabDialog( worksheetInDashboard: Sheet or SheetInfo or string) | None | Shows the Export CrossTab dialog. You can choose to download the crosstab data as a CSV file or to cancel the operation. The worksheetInDashboard parameter is optional. If not specified, the currently active Worksheet is used. If there is no currently active Worksheet, the method throws an exception. |
| exportCrossTabToExcel( worksheetInDashboard: Sheet or SheetInfo or string) | None | Downloads the crosstab data as an Excel file to the default location specified by the browser. The worksheetInDashboard parameter is optional. If not specified, the currently active Worksheet is used. If there is no currently active Worksheet, the method throws an exception. |
|
showShareDialog() |
None |
Equivalent to clicking on the Share toolbar button, which displays a dialog allowing the user to share the visualization by email or by embedding its HTML in a web page. |
|
setFrameSize(width: int, height: int) |
None |
Sets the size of the |
|
getCurrentUrlAsync() |
String |
Gets the URL of the visualization asynchronously. |
|
redoAsync() |
None |
Redoes last action on a sheet, defaults to a single redo unless optional parameters is specified. |
|
undoAsync() |
None |
Undoes action on sheet, defaults to a single undo unless optional parameters is specified. |
|
Name |
Type |
Description |
|
disableUrlActionsPopups |
bool |
Indicates whether to suppress the execution of URL actions. This option does not prevent the URL action event from being raised. You can use this option to change what happens when a URL action occurs. If set to trueand you create an event listener for the URL_ACTION event, you can use an event listener handler to customize the actions. For example, you can direct the URL to appear in an iframeon your web page. See URL Action Example. |
|
hideTabs |
bool |
Indicates whether tabs are hidden or shown. |
|
hideToolbar |
bool |
Indicates whether the toolbar is hidden or shown. The toolbar is always shown if the view is hosted on Tableau Public. |
| instanceIdToClone | string |
Specifies the ID of an existing instance to make a copy (clone) of. This is useful if the user wants to continue analysis of an existing visualization without losing the state of the original. If the ID does not refer to an existing visualization, the cloned version is derived from the original visualization. |
|
height |
string |
Can be any valid CSS size specifier. If not specified, defaults to the published height of the view. |
|
width |
string |
Can be any valid CSS size specifier. If not specified, defaults to the published width of the view. |
|
device |
string |
Specifies a device layout for a dashboard, if it exists. Values can be |
| "filter name" | string | Apply a filter that you specify to the view when it is first rendered. For example, if you have an Academic Year filter and only want to display data for 2022, you might enter "Academic Year": "2022". For more information, see Filtering. |
|
onFirstInteractive |
callback(e: TableauEvent) |
Callback function that is invoked when the If a listener has been attached to the Custom views are not guaranteed to be loaded when the viz becomes interactive. Use the |
|
onFirstVizSizeKnown |
callback(e: VizResizeEvent) |
Callback function that's invoked when the size of the |
|
toolbarPosition |
ApiToolbarPosition |
Specifies the position of the toolbar, if it is shown. The values can be |
|
Name |
Description |
|
TOP |
Positions the toolbar along the top of the visualization. |
|
BOTTOM |
Positions the toolbar along the bottom of the visualization. |
|
Name |
Type |
Description |
|
getViz() |
Viz |
Gets the |
|
isButtonEnabled(toolbarButtonName) |
bool |
Gets a value indicating whether the specified toolbar button is enabled. The supported buttons are defined in the |
|
Name |
Description |
|
UNDO |
Specifies the Undo button in the toolbar. |
|
REDO |
Specifies the Redo button in the toolbar. |
|
Name |
Event Class Passed in the Callback |
Description |
|
CUSTOM_MARK_CONTEXT_MENU |
CustomMarkContextMenu |
Raised when a custom mark context menu item is selected. |
|
CUSTOM_VIEW_LOAD |
CustomViewEvent |
Raised when a custom view has
finished loading. This event is raised after the callback function for |
|
CUSTOM_VIEW_REMOVE |
CustomViewEvent |
Raised when the user removes a custom view. |
|
CUSTOM_VIEW_SAVE |
CustomViewEvent |
Raised when the user saves a new or existing custom view. |
|
CUSTOM_VIEW_SET_DEFAULT |
CustomViewEvent |
Raised when a custom view has been made the default view for this visualization. |
|
FILTER_CHANGE |
FilterEvent |
Raised when any filter has
changed state. The |
|
MARKS_SELECTION |
MarksEvent |
Raised when marks are selected or deselected. |
|
PARAMETER_VALUE_CHANGE |
ParameterEvent |
Raised when any parameter has changed state. |
| STORY_POINT_SWITCH | StoryPointSwitchEvent | Raised after a story point becomes active. |
|
TAB_SWITCH |
TabSwitchEvent |
Raised after the tab switched, but the
|
|
TOOLBAR_STATE_CHANGE |
ToolbarStateEvent | Raised when the state of the specified toolbar button changes. See Toolbar State Example. |
| URL_ACTION | UrlActionEvent |
Raised when a URL action occurs. See the |
|
VIZ_RESIZE |
VizResizeEvent |
Raised every time the frame size is calculated from the available size and the |
|
Name |
Type |
Description |
|
getViz() |
Viz |
Gets the |
|
getEventName() |
TableauEventName |
Gets the name of the event, which is a string, but is also one of the items in the TableauEventName enum. |
|
Name |
Type |
Description |
|
getContextMenuId() |
string |
Gets the |
|
Name |
Type |
Description |
|
getViz() |
Viz |
Gets the Viz object associated with the event. |
|
getEventName() |
TableauEventName |
Gets the name of the event, which is a string, but is also one of the items in the TableauEventName enum. |
|
Name |
Return Type |
Description |
|
getCustomViewAsync() |
Promise<CustomView> |
Gets the CustomView object associated with the event. |
|
Name |
Type |
Description |
|
getViz() |
Viz |
Gets the |
|
getWorksheet() |
Worksheet |
Gets the |
|
getEventName() |
TableauEventName |
Gets the name of the event, which is a string, but is also one of the items in the TableauEventName enum. |
|
getFieldName() |
string |
Gets the name of the field. |
|
Name |
Return Type |
Description |
|
getFilterAsync() |
Promise<Filter> |
Gets the Filter object associated with the event. |
|
Name |
Type |
Description |
|
getViz() |
Viz |
Gets the |
|
getWorksheet() |
Worksheet |
Gets the |
|
getEventName() |
TableauEventName |
Gets the name of the event, which is a string, but is also
one of the items in the |
|
Name |
Return Type |
Description |
|
getMarksAsync() |
Promise<Mark[]> |
Gets the selected marks on the |
|
Name |
Type |
Description |
|
getViz() |
Viz |
Gets the |
|
getEventName() |
TableauEventName |
Gets the name of the event, which is a string, but is also
one of the items in the |
|
getParameterName() |
string |
Gets the name of the parameter that changed. |
|
Name |
Return Type |
Description |
|
getParameterAsync() |
Promise<Parameter> |
Gets the |
|
Name |
Type |
Description |
| getViz() | Viz | Gets the Viz object associated with the event. |
| getEventName() | TableauEventName | Gets the name of the event, which is a string, but is also one of the items in the TableauEventName enum. In this case, it is STORY_POINT_SWITCH. |
| getOldStoryPointInfo() | StoryPointInfo | Gets the StoryPointInfo that was active before the story point switch event occurred. The returned object reflects the state of the story point before the switch occurred. The returned object reflects the state of the story point after the switch occurred. |
| getNewStoryPoint() | StoryPoint | Gets the StoryPoint that is currently active. |
|
Name |
Type |
Description |
|
getViz() |
Viz |
Gets the |
|
getEventName() |
TableauEventName |
Gets the name of the event, which is a string, but is also one of the items in the |
|
getOldSheetName() |
string |
Gets the name of the sheet that was active before the tab switch event occurred. |
|
getNewSheetName() |
string |
Gets the name of the sheet that is currently active. |
|
Name |
Type |
Description |
|
getToolbarState() |
ToolbarState |
Returns the new ToolbarState. |
|
Name |
Type |
Description |
|
getURL() |
String |
Returns the URL object associated with event. |
| getTarget() | String | Returns the target attribute associated with URL (for example, the identifier associated with a browser tab). |
|
Name |
Type |
Description |
|
getViz() |
Viz |
Gets the |
|
getEventName() |
TableauEventName |
Gets the name of the event, which is a string, but is also one of the items in the |
|
GetAvailableSize() |
Size |
Gets the sheetSize record for the current sheet. For more information, see SheetSize Record. |
|
Name |
Type |
Description |
|
getViz() |
Viz |
Gets the Viz object that contains the workbook. |
|
getActiveSheet() |
Sheet |
Gets the currently active sheet (the active tab) |
|
getActiveCustomView() |
CustomView |
Gets the currently active custom view, or null if no custom view is active. |
|
getPublishedSheetsInfo() |
SheetInfo[] |
Note that this is synchronous, meaning that all of the sheets are expected when loaded. |
|
getName() |
string |
Gets the name of the workbook saved to the server. Note that this is not necessarily the file name. |
|
Name |
Return Type |
Description |
| activateSheetAsync(sheetNameOrIndex: object) | Promise<Sheet> | Activates the sheet, either by name or index, and returns a promise of the sheet that was activated. |
|
revertAllAsync() |
Promise |
Reverts the workbook to its last saved state. |
|
getParametersAsync() |
Promise<Parameter[]> |
Fetches the parameters for this workbook. |
|
changeParameterValueAsync( |
Promise<Parameter> |
Changes the value of the parameter with the given name and returns the new |
|
getCustomViewsAsync() |
Promise<CustomView[]> |
Gets the collection of CustomView objects associated with the workbook. |
|
showCustomViewAsync( |
Promise<CustomView> |
Changes the visualization to show the named saved state.
To reset a custom view to the original view, pass in a null value for the
|
|
removeCustomViewAsync( |
Promise<CustomView> |
Removes the named custom view. |
|
rememberCustomViewAsync( |
Promise<CustomView> | Remembers the current state of the workbook by assigning a custom view name. |
|
setActiveCustomViewAsDefaultAsync() |
None |
Sets the active custom view as the default. |
| ParameterDataType | Native JavaScript Type |
|---|---|
| FLOAT | Number |
| INTEGER | Number |
| STRING | String |
| BOOLEAN | Boolean |
| DATE | Date |
| DATETIME | Date |
|
|
|
Name |
Type |
Description |
|
getName() |
string |
The name of the |
|
getIsPrimary() |
bool |
Indicates whether this |
|
getFields() |
Field[] |
Gets an array of |
|
Name |
Type |
Description |
|
getName() |
string |
Gets the field name (i.e. caption). |
|
getAggregation() |
FieldAggregationType |
Gets the type of aggregation, which is one of the
following values: |
|
getDataSource() |
DataSource |
Gets the data source to which this field belongs. |
|
getRole() |
FieldRoleType |
One of the following values: |
|
Name |
Type |
Description |
|
getName() |
string |
User-friendly name for the custom view |
|
getAdvertised() |
bool |
Indicates whether the custom view is public or private. |
|
getDefault() |
bool |
Gets or sets whether this is the default custom view. |
|
getOwnerName() |
string |
Gets the user that created the custom view. |
|
getUrl() |
string |
Unique URL to load this view again. |
|
getWorkbook() |
Workbook |
Gets the Workbook to which this CustomView belongs. |
|
Name |
Return Type |
Description |
|
saveAsync() |
Promise<CustomView> |
After |
|
Name |
Type |
Description |
|
getName() |
string |
Gets the name of the sheet. |
|
getIndex() |
int |
Gets the index of the sheet within the published tabs. Note that hidden tabs are still counted in the ordering, as long as they are published. |
|
getIsActive() |
bool |
Gets a value indicating whether the sheet is the currently
active sheet.Due to a technical limitation, this will always return false if the object is a |
|
getIsHidden() |
bool |
Gets a value indicating whether the sheet is hidden in the UI. Note that if the entire tab control is hidden, it does not affect the state of this flag. This sheet may still report that it is visible even when the tabs control is hidden. |
|
getSheetType() |
SheetType |
Gets the type of the sheet. |
|
getSize() |
SheetSize |
Gets the size information that the author specified when publishing the workbook. |
|
getUrl() |
string |
Gets the URL for this sheet. |
|
getWorkbook() |
Workbook |
Gets the |
|
Name |
Type |
Description |
|
getName() |
string |
Gets the name of the sheet. |
|
getIndex() |
int |
Gets the index of the sheet within the published tabs. Note that hidden tabs are still counted in the ordering, as long as they are published. |
|
getIsActive() |
bool |
Gets a value indicating whether the sheet is the currently active sheet. |
|
getIsHidden() |
bool |
Gets a value indicating whether the sheet is hidden in the UI. Note that if the entire tab control is hidden, it does not affect the state of this flag. This sheet may still report that it is visible even when the tabs control is hidden. |
|
getSheetType() |
SheetType |
Gets the type of the sheet. |
|
getSize() |
SheetSize |
Gets the size information that the author specified when publishing the workbook. |
|
getUrl() |
string |
Gets the URL for this sheet. |
|
getWorkbook() |
Workbook |
Gets the |
|
Name |
Return Type |
Description |
|
changeSizeAsync(SheetSize) |
Promise<SheetSize> |
Sets the size information on a sheet. Note that if the
sheet is a |
|
Name |
Type |
Description |
|
behavior |
SheetSizeBehavior |
Contains an enumeration value of one of the following:
|
|
maxSize |
Size |
This is only defined when behavior is |
|
minSize |
Size |
This is only defined when behavior is |
|
Name |
Return Type |
Description |
|
getName() |
string |
Either "Underlying Data Table" or "Summary Data Table". |
| getData() | array | A two-dimensional array of data without the sheet or column metadata. The first array index is the row index and the second array index is the column index. |
| getColumns() | array<Column> |
The column information, including the name, data type, and index. |
| getTotalRowCount() | int | The number of rows in the returned data. |
| getIsSummaryData() | bool | Whether the data is summary data or underlying data. Returns true for summary data. |
|
Name |
Return Type |
Description |
|
getTableId() |
string |
The identifier that uniquely identifies the logical table. You use the table identifier to get data when you call the |
| getCaption() | string | The name of the logical table as it appears to users in Tableau 2020.2 and later. |
Click the "Get Data" button to get underlying data for the viz.
|
Name |
Return Type |
Description |
|
getFieldName() |
string |
The name of the column. |
| getDataType() | string | The data type of the column. Possible values are float, integer, string, boolean, date, and datetime. |
| getIsReferenced() | bool | Whether the column data is referenced in the visualization. |
| getIndex() | int | The number of rows in the returned data. |
|
Name |
Type |
Description |
|
getParentDashboard() |
Dashboard |
Returns the |
| getParentStoryPoint() | StoryPoint | Returns the StoryPoint object to which this Worksheet belongs (if it’s on a story sheet). Otherwise, it returns null. If the Worksheet instance does not come from a call to StoryPoint.getContainedSheet(), it also returns null. |
|
Name |
Return Type |
Description |
|
getDataSourcesAsync() |
Promise<DataSource[]> |
Gets the primary and all of the secondary data sources for this worksheet. Note that by convention the primary data source should always be the first element. |
| getSummaryDataAsync(getSummaryDataOptions) | Promise<DataTable> | Gets aggregated data for the fields used in the currently active sheet and returns it as an object. You can specify options with an optional parameter. This can only be called on sheets of the WORKSHEET type. |
| getUnderlyingDataAsync(getUnderlyingDataOptions) | Promise<DataTable> | Gets data for all fields in the data source used by the currently active sheet and returns it as an object. You can specify options with an optional parameter. This can only be called on sheets of the WORKSHEET type. Available in Tableau 2020.1 and earlier. |
| getUnderlyingTablesAsync() | Promise<LogicalTable[]> | Gets the underlying logical tables used by the worksheet. The resulting logical tables are determined by the measures in the worksheet. If a worksheet's data source contains multiple logical tables and the worksheet contains only measures from one logical table, this method will return one logical table. This can only be called on sheets of the WORKSHEET type. Available in Tableau 2020.2 and later. See LogicalTable and the Get Underlying Table Data Example. |
| getUnderlyingTableDataAsync(tableID, getUnderlyingDataOptions) | Promise<DataTable> |
Gets data for all fields in the specified logical table used by the currently active sheet and returns it as an object. You can specify options with an optional parameter. This can only be called on sheets of the |
| AppendContextMenuAsync( targetMenu: ApiMenuType, config: ContextMenuOptions) | Promise<string> |
Appends a new menu item into the place specified by targetMenu. Currently, the only allowed location is ApiMenuType.Ubertip (the tooltip that appears when marks are selected). Use the config option to specify the name of the menu item (ContextMenuOptions Class). If successful, this method returns the menuItemId of the new menu item.
|
| RemoveContextMenuAsync( targetMenu: ApiMenuType, menuItemId: string) | Promise<void> |
Removes the menu item specified by menuItemId from the designated context menu.
|
|
ExecuteContextMenuAsync( targetMenu: ApiMenuType, menuItemId: string) |
Promise<void> | Executes the menu item specified by menuItemId from the designated context menu. You can use this method for testing the context menu item. |
|
Name |
Value |
Description |
| ignoreAliases | bool | Do not use aliases specified in the data source in Tableau. Default is false. |
| ignoreSelection | bool | Only return data for the currently selected marks. Default is false. |
| maxRows | int |
The number of rows of data that you want to return. Enter 0 to return all rows. |
|
Name |
Value |
Description |
| ignoreAliases | bool | Do not use aliases specified in the data source in Tableau. Default is false. |
| ignoreSelection | bool | Only return data for the currently selected marks. Default is false. |
| includeAllColumns | bool | Return all the columns for the data source. Default is false. |
| maxRows | int |
The number of rows of data that you want to return. Enter 0 to return all rows. |
|
Name |
Type |
Description |
|
getObjects() |
DashboardObject[] |
Gets the collection of objects. |
|
getWorksheets() |
Worksheet[] |
Gets the collection of worksheets contained in the
dashboard. Note that this is a helper method and is equivalent to looping
through |
| getParentStoryPoint() | StoryPoint | Returns the StoryPoint object to which this Dashboard belongs (if it’s on a story sheet). Otherwise, it returns null. If the Dashboard instance does not come from a call to StoryPoint.getContainedSheet(), it also returns null. |
|
Name |
Type |
Description |
|
getObjectType() |
DashboardObjectType |
Gets what the object represents, which is an |
|
getDashboard() |
Dashboard |
Gets the |
|
getWorksheet() |
Worksheet |
If |
|
getPosition() |
Point |
Gets the coordinates relative to the top-left corner of the dashboard of the object. |
|
getSize() |
Size |
Gets the size of the object. |
|
Name |
Type |
Description |
|
getName() |
string |
Gets the name of the sheet. |
|
getIndex() |
int |
Gets the index of the sheet within the published tabs. Note that hidden tabs are still counted in the ordering, as long as they are published. |
|
getIsActive() |
bool |
Gets a value indicating whether the sheet is the currently active sheet. |
|
getIsHidden() |
bool |
Gets a value indicating whether the sheet is hidden in the UI. Note that if the entire tab control is hidden, it does not affect the state of this flag. This sheet may still report that it is visible even when the tabs control is hidden. |
|
getSheetType() |
SheetType |
Gets the type of the sheet, which should always be |
| getSize() | SheetSize | Gets the size information that the author specified when publishing the workbook. |
| getUrl() | string | Gets the URL for this sheet. |
| getWorkbook() | Workbook | Gets the Workbook to which this Sheet belongs. |
|
Name |
Type |
Description |
|
getStoryPointsInfo() |
StoryPointInfo[] |
Gets an array (not a collection) of |
| getActiveStoryPoint() | StoryPoint | Gets the currently active story point. |
|
Name |
Type |
Description |
|
changeSizeAsync(size: SheetSize) |
Promise<SheetSize> |
Sets the size information on a sheet. |
|
Name |
Type |
Description |
|
activateStoryPointAsync(index: int) |
Promise<StoryPoint> |
Activates the story point at the specified index and returns a promise of the activated StoryPoint. Throws a |
| activateNextStoryPointAsync() | Promise<StoryPoint> | Activates the next story point if there is one. If the current story point is the last one, then is stays active. |
| activatePreviousStoryPointAsync() | Promise<StoryPoint> | Activates the previous story point if there is one. If the current story point is the first one, then it stays active. |
| revertStoryPointAsync(index: int) | Promise<StoryPoint> | Reverts the story point at the specified index and returns a promise of the reverted StoryPoint. Throws a tableau.ErrorCode.INDEX_OUT_OF_RANGE error if the index is less than zero or greater than or equal to the number of story points in the array. |
|
Name |
Type |
Description |
|
getIndex() |
int |
Gets the zero-based index of this story point within the parent Story sheet. |
| getCaption() | string | Gets the content of the textual description for this story point. |
| getIsActive() | Bool | Gets a value indicating whether the story point is the currently active point in the story. |
| getIsUpdated() | Bool | Gets a value indicating whether the story point is updated, meaning that there are no changes from the last time the story point was “captured”. |
| getParentStory() | Story | Gets the Story object that contains the story point. |
|
Name |
Type |
Description |
|
getIndex() |
int |
Gets the zero-based index of this story point within the parent Story sheet. |
| getCaption() | string | Gets the content of the textual description for this story point. |
| getIsActive() | Bool | Gets a value indicating whether the story point is the currently active point in the story. |
| getIsUpdated() | Bool | Gets a value indicating whether the story point is updated, meaning that there are no changes from the last time the story point was “captured”. |
| getContainedSheet() | Sheet | Gets the sheet that this story point contains. This will be null if the story point does not have a contained sheet. |
| getParentStory() | Story | Gets the Story object that contains this story point. |
|
Name |
Type |
Description |
|
getName() |
string |
A unique identifier for the parameter, as specified by the user. |
|
getCurrentValue() |
DataValue |
The current value of the parameter. |
|
getDataType() |
ParameterDataType |
The data type of the parameter can be one of the following:
|
|
getAllowableValuesType() |
ParameterAllowableValuesType |
The type of allowable values that the parameter can
accept. It can be one of the following enumeration items: |
|
getAllowableValues() |
DataValue[] |
If the parameter is restricted to a list of allowable values, this property contains the array of those values. Note that this is not a standard collection, but a JavaScript array. |
|
getMinValue() |
DataValue |
If |
|
getMaxValue() |
DataValue |
If |
|
getStepSize() |
Number |
If |
|
getDateStepPeriod() |
PeriodType |
If |
|
Name |
Return Type |
Description |
|
getFiltersAsync() |
Promise<Filter[]> |
Fetches the collection of filters used on the dashboard. |
|
applyFilterAsync(
|
Promise<string> |
Applies a simple categorical filter (non-date) to the dashboard. This method is similar to the method used for worksheets, but applies the filter to all the worksheets in the dashboard that have that same field. Note that the filter is ignored by a worksheet if the worksheet doesn't have the relevant field in its data source. The method eturns the For example:
|
|
Name |
Return Type |
Description |
|
getFiltersAsync() |
Promise<Filter[]> |
Fetches the collection of filters used on the sheet. |
|
applyFilterAsync(
|
Promise<string> |
Applies a simple categorical filter (non-date). See the filtering examples for more details on these functions. Returns the For example:
|
|
applyRangeFilterAsync(
|
Promise<string> |
Applies a quantitative filter to a field or to a date. If a range is specified that is outside of the domain min/max values, no error is raised and the command is allowed. Subsequent calls to You can also specify NullOption values as part of the RangeFilterOptions Record to include or exclude null values. |
|
applyRelativeDateFilterAsync(
fieldName: string, options: RelativeDateFilterOptions) |
Promise<string> | Applies a relative date filter. |
|
applyHierarchicalFilterAsync(
fieldName: string, values: object, options: HierarchicalFilterOptions) |
Promise<string> | Applies a hierarchical filter. The values parameter is either a single value, an array of values, or an object { levels: ["1", "2"] }. |
| clearFilterAsync(fieldName: string) | Promise<string> | Clears the filter, no matter what kind of filter it is. Note that the filter is removed as long as no associated quick filter is showing for the field. If there is a quick filter showing, then the filter is kept, but it’s reset to the “All” state (effectually canceling the filter). For relative date filters, however, an error is returned since there is no “All” state for a relative date filter. To clear a relative date filter with a quick filter showing, you can call applyRelativeDateFilter() instead using a range that makes sense for the specific field. |
|
Name |
Type |
Description |
|
isExcludeMode |
bool |
Determines whether the filter will apply in exclude mode or include mode. The default is include, which means that you use the fields as part of a filter. Exclude mode means that you include everything else except the specified fields. |
|
Name |
Type |
Description |
|
min |
int or date |
Minimum value for the range (inclusive). Optional. Leave blank if you want a <= filter. |
|
max |
int or date |
Maximum value for the range (inclusive). Optional. Leave blank if you want a >= filter. |
|
nullOption |
NullOption |
Specifies whether to include null values. The options are as follows. To only include non-null values: To include all values, null and non-null: |
|
Name |
Type |
Description |
|
anchorDate |
Date |
The UTC date from which to filter. |
|
periodType |
PeriodType |
Year, quarter, month, etc. |
|
rangeType |
DateRangeType |
|
|
rangeN |
int |
The number used when the |
|
Name |
Type |
Description |
|
getWorksheet() |
Worksheet |
Gets the parent worksheet |
|
getFilterType() |
FilterType |
Gets the type of the filter. See FilterType Enum for the values in the enum. |
|
getFieldName() |
string |
Gets the name of the field being filtered. Note that this is the caption as shown in the UI and not the actual database field name. |
|
Name |
Return Type |
Description |
|
getAppliedWorksheetsAsync() |
Promise<string[]> |
Gets the list of worksheets that have the filter applied. |
|
getFieldAsync() |
Promise<Field> |
Gets the field that is currently being filtered. |
| setAppliedWorksheetsAsync(applyToWorksheets: string[] ) | Promise<string[]> | Applies the filter to the specified list of worksheets. If the worksheet(s) do not exist or do not contain the field in their data sources, an exception is thrown. |
|
Name |
Description |
|
NULL_VALUES |
Only include null values in the filter. |
|
NON_NULL_VALUES |
Only include non-null values in the filter. |
|
ALL_VALUES |
Include null and non-null values in the filter. |
|
Name |
Type |
Description |
|
getIsExcludeMode() |
bool |
Gets a value indicating whether the filter is exclude or include (default). |
|
getAppliedValues() |
DataValue[] |
Gets the collection of values that are currently set on the filter. This is a native JavaScript array and not a keyed collection. If more than 5000 values are selected, only the first 200 are returned. |
|
getIsAllSelected() |
bool | Gets a value indicating whether all values for the filter are selected. Returns true if all values in the filter are selected. |
|
Name |
Type |
Description |
|
getDomainMin() |
DataValue |
Gets the minimum value as specified in the domain. |
|
getDomainMax() |
DataValue |
Gets the maximum value as specified in the domain. |
|
getMin() |
DataValue |
Gets the minimum value, inclusive, applied to the filter. |
|
getMax() |
DataValue |
Gets the maximum value, inclusive, applied to the filter. |
|
getIncludeNullValues() |
bool |
Indicates whether null values are included in the filter. |
|
Name |
Type |
Description |
|
getPeriod() |
PeriodType |
The date period of the filter. See PeriodType Enum for the values in the enum. |
|
getRange() |
DateRangeType |
The range of the date filter (years, months, etc.). See DateRangeType Enum for the values in the enum. |
|
getRangeN() |
int |
When |
|
Name |
Type |
Description |
| value | object | Contains the raw native value as a JavaScript type, which is one of String, Number, Boolean, or Date |
|
formattedValue |
string |
The value formatted according to the locale and the formatting applied to the field or parameter. |
|
Name |
Description |
|
CATEGORICAL |
Categorical filters are used to filter to a set of values within the domain. |
|
QUANTITATIVE |
Quantitative filters are used to filter to a range of values from a continuous domain. |
|
HIERARCHICAL |
Hierarchical filters are used to filter to a set of values organized into a hierarchy within the domain. |
|
RELATIVE_DATE |
Relative date filters are used to filter a date/time domain to a range of values relative to a fixed point in time. |
|
Name |
Description |
|
ALL |
Adds all values to the filter. Equivalent to checking the (All) value in a quick filter. |
|
REPLACE |
Replaces the current filter values with new ones specified in the call. |
|
ADD |
Adds the filter values as specified in the call to the current filter values. Equivalent to checking a value in a quick filter. |
|
REMOVE |
Removes the filter values as specified in the call from the current filter values. Equivalent to unchecking a value in a quick filter. |
|
Name |
|
YEARS |
|
QUARTERS |
|
MONTHS |
|
WEEKS |
|
DAYS |
|
HOURS |
|
MINUTES |
|
SECONDS |
|
Name |
Description |
|
LAST |
Refers to the last day, week, month, etc. of the date period. |
|
LASTN |
Refers to the last N days, weeks, months, etc. of the date period. |
|
NEXT |
Refers to the next day, week, month, etc. of the date period. |
|
NEXTN |
Refers to the next N days, weeks, months, etc. of the date period. |
|
CURRENT |
Refers to the current day, week, month, etc. of the date period. |
|
TODATE |
Refers to everything up to and including the current day, week, month, etc. of the date period. |
|
Name |
Return Type |
Description |
|
clearSelectedMarksAsync() |
void |
Clears the selection for this worksheet. |
|
getSelectedMarksAsync() |
Promise<Mark[]> |
Gets the collection of marks that are currently selected. |
|
selectMarksAsync( |
void |
Selects the marks and returns them. For example, a single field (dimension) and value:
Or select marks based upon range:
|
|
selectMarksAsync( |
void |
Allows selection based on this syntax for the first
parameter: For example, selecting by product and state.
For more examples of how you can use this method, see Selecting Marks and the Select Marks sample. |
|
selectMarksAsync( |
void |
Selects an array of marks. See the Mark Class and the following example. |
|
Signature |
Description |
|
Mark(pairs: Pair[]) |
Creates a new |
|
Name |
Type |
Description |
|
getPairs() |
Pair[] |
Gets a collection of field name/value pairs associated with the mark. |
|
Signature |
Description |
|
Pair(fieldName: string, value: object) |
Creates a new |
|
Name |
Type |
Description |
| fieldName | string | The field name to which the value is applied. |
| value | object | Contains the raw native value for the field as a JavaScript type, which is one of String, Number, Boolean, or Date. |
|
formattedValue |
string |
The value formatted according to the locale and the formatting applied to the field. |
|
Name |
Description |
|
REPLACE |
Replaces the current marks values with new ones specified in the call. |
|
ADD |
Adds the values as specified in the call to the current selection. Equivalent to control-clicking in desktop. |
|
REMOVE |
Removes the values as specified in the call from the current selection. Equivalent to control-clicking an already selected mark in desktop. |
|
Name |
Type |
Description |
|
width |
int |
Expressed in pixel units. |
|
height |
int |
Expressed in pixel units. |
|
Name |
Type |
Description |
|
x |
int |
Expressed in pixel units. |
|
y |
int |
Expressed in pixel units. |
|
Name |
Type |
Description |
|
displayName |
string |
The name of the custom menu item as you want it to appear in Tableau. |
|
Name |
Type |
Description |
|
Ubertip |
string |
The custom menu item will appear in the marks selection tooltip (also known as an "ubertip"). |
Click the "Get Data" button to get underlying data for the viz.
|
Name |
Return Type | Description |
|---|---|---|
|
get(key : string) |
Collection item type |
Gets the element in the collection associated with the key, or undefined if there is nothing associated with it. |
|
has(key : string) |
bool |
Returns true if there is an element in the collection associated with the key; otherwise, false. |