Skip to content

the function vf() (view filter) does not handle with special character as "&" #578

Closed

Description

@ChadyNassar

I am using the TSC API on python to generate multiple pdf files (one for each client).
When using pdf_req_option.vf(parameter,value)
Where parameter = 'client' and value = the name of each client
All the pdf are generated correctly except for one client that have a '&' in his name.
For this client the PDF is generated but without any data inside.
It is the same result than if I gave a fake value that dosen't exist in my list of 'client' parameter.

Activity

  1. divinorum-webb commented on Mar 8, 2020

    @divinorum-webb

    Hey Chady,

    I encountered a similar issue very recently. You can work around this successfully, and it is worth noting that even if TSC scrubbed the '&' value from your filter value, your dashboard would not display the correct data due to the values no longer matching -- so you must fix this on your end.

    First, this is not an error of the TSC library -- the '&' character is used to append additional URL params to your URL string, so when the URL string encounters the '&' in your client's name it assumes the text that follows is an entirely new URL parameter.

    Even though this cannot be fixed from TSC's side, here is how you can resolve the issue:

    1. build a new version of your field in Tableau which removes the '&' character from the field
    2. be sure to use this new field as a filter in your dashboard / view that is published
    3. reference the new field as your vf_ filter value

    Hope that helps,
    Elliott

  2. ChadyNassar commented on Mar 9, 2020

    @ChadyNassar
    Author
  3. divinorum-webb commented on Mar 9, 2020

    @divinorum-webb

    Hey Chady, that's better than my fix! I'm going to use your approach.

  4. vignesh1609 commented on Jul 8, 2020

    @vignesh1609

    Hey all, My filters are not working with .vf() i am getting pdf with the filters which is published . can you suggest me how to resolve this issue.

  5. TimMoyce commented on Nov 29, 2020

    @TimMoyce

    Is there any way of passing multiple parameters to a single view
    I currently have
    pdf_req_option.vf(filter_criteria1, Parameter_StoreBrand)
    but cannot find a solution to add a second criteria. I am aware how to do this using URL parameters but not the TSC module
    Thanks

  6. seve-martinez commented on Mar 31, 2021

    @seve-martinez

    Is there any way of passing multiple parameters to a single view
    I currently have
    pdf_req_option.vf(filter_criteria1, Parameter_StoreBrand)
    but cannot find a solution to add a second criteria. I am aware how to do this using URL parameters but not the TSC module
    Thanks

    Hi @TimMoyce,

    If you want to add multiple values such as in a drop-down selection box, you can do something like
    pdf_req_options.vf('filter_name', 'value1,value2,value3')

    If you want to add multiple filters, then you can create a dictionary of your filters and then loop through them like so:

    for k, v in filters.items(): 
         pdf_req_options.vf(k, v)
    
    server.views.populate(view, pdf_req_option)
    

    Please note that you will likely have to do some formatting of your dictionary data before.

  7. github-actions commented on Aug 18, 2026

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. If this is still relevant, please comment to keep it open.

  8. jacalata commented on Aug 25, 2026

    @jacalata
    Contributor

    Sweep note: this is resolved on current TSC. Filter values passed to vf() (request_options.py:352) end up in the params= dict handed to requests in Endpoint.get_request (endpoint.py:200-215), which URL-encodes them - so & is sent as %26 without the caller having to escape it. The unencoded legacy path (apply_query_params) only fires against API < 3.7 (Tableau 2020.1), which is well out of support. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions