Join the Webstudio community

Updated 4 days ago

baserow - select list form filtering

Hi there,
I successfully connected to my Baserow database and got the tick box and search filters working — it’s great!

Now I’m trying to adapt the filters to work with a new select list form, but I’m having some trouble using it as a filter for my database. I suspect I’m missing something simple???

If anyone could share some advice, I’d greatly appreciate it.

Thanks in advance!
J
G
23 comments
Start by setting the values to the internal ids of the select list items in baserow. You set use field names to false meaning everything needs to be an ID. You can find those in the API docs. Ids are on the left in one of the attachments
Attachments
Screenshot_2025-01-01_at_10.08.16_AM.png
Screenshot_2025-01-01_at_10.08.03_AM.png
Screenshot_2025-01-01_at_10.07.16_AM.png
Thank you very much John for the help, I thought I had done that in baserow data url but maybe I am not really understanding what you mean. I used thoses ids.
Attachments
image.png
image.png
I fear I maybe doing something wrong with the binding expression
Oh you did! The problem is you are saying "if Culot is present, filter by every value in the list". Instead, it needs to be "If Culot is present, filter by the currently selected item which is system.search.Colot". But you'd need to change the values in the select list so that it just passes that value right into your query
This is my current expression for the selected proprieties of one element of the list : System.search.Culot ? true : false
and for the value proprety I entered "e14" which is the string of the selected list element of baserow
I am not well versed at all into all of this, I am sorry I am probably making a basic mistake somewhere that I am not seeing.
First, change each of the select list item values to match the IDs in the api docs
Attachment
Screenshot_2025-01-01_at_12.31.03_PM.png
Once you do that and submit the form, the url will be like

?cutlot=myBaserowId1
Then in your resource you will say something like

Plain Text
`{"type":"single_select_equal","field":3200320,"value":"${system.search.culot && system.search.Culot}"}`


meaning, if the cutlot filter is applied, filter by its value.

In the example that means this ?cutlot=myBaserowId1

Will yield this

Plain Text
`{"type":"single_select_equal","field":3200320,"value":"${system.search.culot && myBaserowId1}"}`
Hey John,
I have changed the list item values.
As you expected the url is as such :

?search=&culot=2400750

I then updated ressources using your code. However it is still not working 😭
Attachments
image.png
image.png
Make cutlot lowercase here and it'll work
Attachment
Screenshot_2025-01-02_at_5.51.23_AM.png
Indeed it works now, thank you very much John !
great, you're welcome!
I hope this isn’t too much to ask, but I’ve run into something I couldn’t find any documentation for and was wondering if there’s a simple workaround. Its still the same kind of issue as previously...

I added custom HTML to my form to include a range-type input since it wasn’t available in WebStudio’s featured blocks. Is there a way to filter data based on the value selected on the embeded slider?

Here is my htlm embeded code

<div class="range">
<input type="range" min="0" max="4">
<div class="ticks">
<span class="tick">5</span>
<span class="tick">4</span>
<span class="tick">3</span>
<span class="tick">2</span>
<span class="tick">1</span>

</div>
</div>
Attachment
image.png
Theres a range slider you need to add input type text (bad naming tbh) and then change the type in settings to range
Found it ! thanks again john however I am in need of a custom type of range slider, with ticks , so I'd rather use my custom one, Do you think there a way to filter data based on its value ?

https://p-7e49c935-94a7-4227-8eb8-a71731850c76.apps.webstudio.is/?authToken=e29ab32f-5c53-432c-9386-fe67c16849ad&mode=preview
If you give the input a name in the custom code and submit the form, does its value show in the system.search? I'm curious to know
yes ! ?search=&culot=&rangeinput=2
yes thats very cool thanks ! now I need to find a way to convert the values given by the slider into system search into baserowID in order to effectively filter (like previously)? It seems tricky with a range slider to put non linear values
I used the ternary operator to map the range input values (1 to 5) to their respective baserowid. And it works, but maybe there is a better way to do it ?
Attachment
image.png
Nice if that works then go for it. There needs to be some mapping between inputs and baserow ids and that way makes sense to me
Add a reply
Sign up and join the conversation on Discord