Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions tableauserverclient/server/request_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,47 @@ def get_query_params(self):

def vf(self, name: str, value: str) -> Self:
"""Apply a filter based on a column within the view.
Note that when filtering on a boolean type field, the only valid values are 'true' and 'false'

For more detail see: https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_filtering_and_sorting.htm#Filter-query-views
Serialized to the REST API as ``vf_<name>=<value>``. The rules below
describe how the server interprets the wire value. ``vf()`` itself
does not apply any Tableau-specific escaping or semantic transforms
to your value; it only percent-encodes the value for HTTP transport,
which the server decodes back before applying the rules below.

Value syntax
------------
- **Exact match (default):** a single value matches rows where the
column equals that value exactly. Case-sensitivity follows the
underlying data source.
- **OR-list:** commas separate alternatives, so ``"East,West"``
matches rows where the column is ``East`` OR ``West``.
- **Escaping** applies to two characters only, comma and backslash;
all other characters (``&``, ``=``, ``/``, ``#``, ``%``, ``+``,
quotes, brackets, etc.) pass through untouched and the server
treats them as literal data. Percent-encoding is transport only:
``%2C`` and ``%5C`` reach the server as ``,`` and ``\\`` and are
then processed like any other comma or backslash -- so URL-
encoding does NOT escape a literal comma or backslash. To match a
value containing a literal comma, escape it:
``"Rock\\, Paper\\, Scissors"`` matches ``Rock, Paper, Scissors``
(without escaping, the comma starts an OR-list). To match a
literal backslash, double it: ``"C:\\\\temp\\\\file"`` matches
``C:\\temp\\file``.
- **Empty value** (``vf_<name>=``) is observed to override any
workbook-embedded filter on that column, effectively widening it
to all values. Not officially documented; behavior may change
without notice.
- **Wildcards** (``*``) are NOT supported by the REST view-filter
layer. Wildcard matching is a viz-configured behavior on filter
controls inside a workbook; use ``.parameter()`` and design the
workbook accordingly if you need it.
- **Ranges, comparisons, operators** (``>``, ``<=``, ``BETWEEN``,
etc.) are NOT supported. Design the workbook's filters to expose
the shape you need at export time.
- **Booleans:** the only valid values are ``'true'`` and ``'false'``.

For more detail see:
https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_concepts_filtering_and_sorting.htm#Filter-query-views

Parameters
----------
Expand Down
Loading