Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ChadyNassar opened this issue Mar 4, 2020 · 6 comments
Labels

Comments

@ChadyNassar
Copy link

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.

@divinorum-webb
Copy link

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

@ChadyNassar
Copy link
Author

ChadyNassar commented Mar 9, 2020 via email

@divinorum-webb
Copy link

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

@vignesh1609
Copy link

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.

@TimMoyce
Copy link

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

@seve-martinez
Copy link

seve-martinez commented Mar 31, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants