Ignore URL params when null

I want to send a GET request with URL params specified by some components in retool. The issue that I have is that when the components are empty I don't want the params to appear at all (instead of sending null.
I tried different things:

  1. Adding the URL params normally, but this results in the API telling me that None is not a valid choice.
  2. Using an empty string when the field is not selected results in the API telling me that " is not a valid value:
  3. Manually building the URL, saving it in a temporary state and adding that temporary state to the URL results in the ? being encoded as %3F:
    Screenshot 2022-09-19 at 09.47.47

What are my options here? As soon as I try to move the ? to the URL retool identifies it as a URL param and adds another = to the end of the query which makes it fail.

Hey @ktrebing!

You can disable url parameters by passing your conditional to the key field instead of the value field. Can you try something like this?


{{ projectFilterSelectBudget.value ? "budget" : null }}


{{ projectFilterSelectBudget.value }}
1 Like

Amazing! Thank you!