diff --git a/tableauserverclient/server/request_options.py b/tableauserverclient/server/request_options.py index 5a8600908..8ea4cba13 100644 --- a/tableauserverclient/server/request_options.py +++ b/tableauserverclient/server/request_options.py @@ -351,9 +351,42 @@ 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_=``. The rules below + describe how the server interprets the wire value; ``vf()`` itself + does not transform your input. + + 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 -- ``vf()`` URL- + encodes them for transport and the server treats them as literal + data. 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``. URL-encoding (``%2C``, ``%5C``) does NOT + escape either character. + - **Empty value** (``vf_=``) overrides any workbook-embedded + filter on that column, effectively widening it to all values. + This is undocumented but stable behavior that some users rely on. + - **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 ----------