Académique Documents
Professionnel Documents
Culture Documents
Limits
Background
This short set of material covers how Tableau Server Views can be invoked
via URLs while passing values for filters along on the URL.
This capability is particularly useful when using the Tableau Server embedded
views capability. Embedded views allow you to place a Tableau View inside
any other web application you have a portal, a wiki page, or any other web-
based application. In these scenarios, you may want the view to be displayed
and have filters for the data be passed to it from other aspects of your web
application.
Whether you embed the views, or just create links directly to the standard
Tableau Server interface, the ability to pass filter values along with the URL to
open the view is a powerful technique to provide a more customized
experience for the person working with the view.
The basic URL pattern
The examples in the rest of the document will open a workbook named Coffee
Sales, which was published with a sheet named Sales Performance. The base url
for this document is:
http://servername/views/CoffeeSales/SalesPerformance
Spaces and many special characters are removed from workbook and sheet names,
for example, the Tableau sample workbook named Wow! becomes just Wow in
the URL, and a sheet named
Sales Attainment By Geo becomes SalesAttainment-ByGeo.
The best way to see the precise URL for a specific view is to simply open it from the
Tableau Server and examine the URL in your browser.
The original view
This is the base view that we will use in all the rest of our examples. This view
was built using the Sample Coffee Chain data, and has the structure:
Column Shelf: Market and Sales
Row Shelf: Product Type, Type, and Product
Color Shelf: Profit
Your first filter!
To limit the view to just show the West, use the URL:
http://servername/views/CoffeeSales/SalesPerformance?Market=West
The interesting way the filters work is when passing multiple values for a specific filter is
that all other filters passed in need to have the same number of values specified. In
essence, it is building a matrix of the cells you would like to see in the resulting view.
For example, if you want to see Coffee and Espresso sales in just the West, you would
specify:
?Product%20Type=Coffee,Espresso&Market=West,West
Which is instructing the view to get coffee in the west and espresso in the west.
Simply having Market=West will result in an error on the server and not return a view.
You can even pass filters for items that are not included in the current view, and Tableau will
automatically add that item to the level of detail and set the filter.
Extending our example, the database also has a State column in it, which was not included
in the original view that we constructed. Passing State= as one of the filter values will add
State to the Level of Detail and set the filter. The view will be restricted to just the state(s)
specified.
Adding limits on new fields
Passing a filter for State, even though that field isnt used in the view:
http://servername/views/CoffeeSales/SalesPerformance?State=California,Wisconsin
The second thing to remember is that many databases store all date values as datetime
fields, so you may need to pass a time value along with your date.
If you data is just a date field (with no time), the URL would look like:
http://servername/views/CoffeeSales/SalesPerformance?Date=1999-07-01
If you have a database with datetime values, the URL would look like:
http://servername/views/CoffeeSales/SalesPerformance?Date=1999-07-01%2022:18:00
Date values
In this example, we are asking for the display from our Coffee Sales/Sales Performance
view to be filtered to only show data from July 1, 1999.
http://servername/views/CoffeeSales/SalesPerformance ?Date=1999-07-01%2000%3A00%3A00
(the value is URL encoded, which converts the space to %20, and the colons in the timepart
to %3A)
http://servername/views/CoffeeSales/SalesPerformance ?Date=1999-07-01,1999-09-01,1999-10-01
What about measures?
All the examples up to this point have been setting filters on dimensions. You can also set
filters on measures via the URL. All limit values are equality limits. There is no current
support for greater than or less than, or shortcuts for ranges. If you have multiple values,
just comma separate them.
http://servername/views/CoffeeSales/SalesPerformance ?Profit=0,100,250