Collections

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(Link opens in a new window).

Many classes have collections of items, where each item has a key (typically an ID or a name). Examples include a collection of sheets keyed by name or the list of parameters on a sheet keyed by name. Collections are publicly immutable, exposing read-only functionality. Each Collection array is keyed with its elements' identifiers. For example, the result of Workbook.getPublishedSheetsInfo() is an array with the index corresponding to the position of the sheet in the workbook.

var sheet = workbook.getPublishedSheetsInfo()[0];

It is also keyed by the sheet name so that you can access it like this:

var sameSheet = workbook.getPublishedSheetsInfo().get("Sheet 1");

Collection Interface

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.


Thanks for your feedback!Your feedback has been successfully submitted. Thank you!