Replies: 4 comments
-
Ok, after reading up on some of the relationship picker docs, I found that
That makes sense for the array representation of the returned value but why is it a string and not iterable in my case? Also, trying to get a deeper understanding of this, I imported the app export from the Cascading dropdown filters tutorial. The "Try it out!" doesn't work for me, nor does importing the example app locally ('Cities' doesn't filter based on 'Country' value). So either something is broken or there's something seriously wrong with my setup? For completeness:
with |
Beta Was this translation helpful? Give feedback.
-
After working on something else for a while, coming back to this I can't figure out how to make this work. Maybe my previous messages weren't very clear and if yes, I'm sorry for that. I'm simply trying to filter one picker based on the value of another. At first, I tried with a multi-step form block in which two fields (Country, City) come from a postgres db. In postgres, the columns are foreign keys (one-to-many) pointing at countries(id) and cities(id) respectively. The relationship has been created in each of the tables within Budibase: and the When setting a filter on the City field: every time the Country picker's value changes, it should only show cities where the filter applies, correct? And that's what isn't working (in preview or published). Since it's a multi-step-form, I've tried different approaches but can't get it to work unless I use two nested data providers in a form and two option pickers (one for countries, the other for cities). The data provider then gets filtered based on the value of the Country picker's field value and onChange-actions on the country field reset the cities value as well as refresh the city data provider. I've also followed the Cascading dropdown filters Guide to the letter and for me it doesn't work. While debugging this a little, the value from the Country field is being used in the javascript filter expression (confirmed POST to
results in correct response:
But the picker never gets reset/ updated with the correct select options, instead showing all cities. I could also observe that on page load, the field value for Country is Also: The filter action seems to be called twice for every 1st call payload:
2nd call payload:
I've tried to make this a little clearer, hoping that someone can shed some light on this. In the meantime, I would appreciate if anyone could try the example app from the guide and let me know if it works for them. I would really appreciate. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Ok, this has been known since 2024-06-09 and is an open bug. Closing and monitoring. |
Beta Was this translation helpful? Give feedback.
-
This has been fixed for me with #13893 and tutorial Cascading dropdown filters is working as expected. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi,
not posting as Issue yet because I might misunderstand sth here.
External postgres DB and running self-hosted docker with budibase version 2.32.0.
I came upon this when trying to filter a form field based on the value of another form field in the same multi-step form:
I wanted to filter the birthplace based on the value of the birth country. Both are many-to-one rels: country of birth goes to countries(id) and place of birth to cities(id). Since cities contain +150K entries, filtering the place of birth based on the previously chosen country makes sense.
This is not possible though, since the form field value is URI encoded (e.g.
%5B1%5D
where it should be1
(int)). Recognising a potential array representation I also triedreturn $("new individual.Fields.country_of_birth")[0]
with no solution, though an array wouldn't make sense here since the column is defined asint
, notint[]
.I've recreated a new budibase app with a new database for testing purposes. Created the database and content with two tables, simple many-to-one rel via foreign key in people to countries(id). Defined relation in postgres and created one screen with a form to add a new entry. Then edit the action for the
on change
property of birth country to prompt the user with the binding of the form value. Same result. Also tried triple binding{{{ Field Value }}}
to no avail.I'm attaching the poc app export here.
poc_rel_form_value-export-1726300041467.tar.gz
And here's the sql for the tables:
There are some similar issues around.
The workarounds for some don't make sense to me, though. And if there was a fix, it doesn't seem to catch? Maybe the recent sql relationship code update re-introduced something or is this unrelated?
EDIT: Ok, I think I can't update the second form field via a filter
on change
of the first. The filter is only applied on form loading apparently. I've managed to set the filter value correctly like so:but it doesn't filter 'after the fact'. Will have to look into building the form differently for this to work.
The gist of the question remains though: Why doesn't
$("new individual.Fields.country_of_birth")
return anint
vs URI-encoded array string?/EDIT
I appreciate any input before posting this as an issue.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions