How to use query variables with multiple values (array)

Right, so I feel like this isn’t that easy to find in the docs or forum so here’s how I did it (let me know if there’s a better way!):

Create a variable with type Query, leave default value empty

Then wherever in your workflow you’re adding the values to your variable (in my case it’s a multiselect field) use the Join formula to turn the array into a comma seperated list. This is also how it will appear in your URL ( url.com?variable=value1,value2 )

Now over in your data source, where you bind the input to your api call, you’ll be wanting to turn that comma seperated string back into an array, so that you can feed the array to your API call (in my case in xano, I have an input>text>list

So make sure if you use Xano, that the input is set to List, and I have nullable on in case it’s empty

Drop a like if this helped you!

2 Likes

I have never used query types actually. Can you expalain why there usefull in this case? Could you just create an array variable and then you wouldn’t need to do the join or the split.

Soo in my case I have a page with listings, and filters on the left. I want the URL to change when people click on the filters, so that eg. if they share a link of a filtered page, or bookmark it or whatever, that url matches the filters. This way the ‘back’ button on your browser also behaves in a way that you can cycles back to previous filtered views. It’s pretty much common practice for those kind of pages

This only works if you make the variable that stores your filter a query type

2 Likes

Is the endpoint a GET endpoint in Xano? GET endpoints does not accept arrays, so if possible, set it to a POST endpoint; or split it in the backend.