Hi I am new to Retool! I am trying to filter a form component dropdown (EID) based on the previous two dropdowns that contain first and last name. Currently it is only filtering on the first name and returning those EIDs . I am open to any suggestions. Thanks in advance.
welcome to the community - can you share the code that's displaying the list of dropdown options?
select eid from roster
where {{ !select1.value }} OR first ILIKE {{ '%' + select1.value + '%' }}
AND
{{ !select2.value }} or last ILIKE {{ '%' + select2.value + '%' }}
@spatel if the table is small enough, one easy workaround would be to query the entire table on load, then use a JS transformer to filter the values for the EID based on the values of the first couple selects and have that transformer become the source of your EID dropdown.
Ahh I think you might need some brackets to specify the logic a bit more clearly for SQL.
Try this:
select eid from roster
where (
( {{ !select1.value }} OR first ILIKE {{ '%' + select1.value + '%' }} )
AND
( {{ !select2.value }} or last ILIKE {{ '%' + select2.value + '%' }} )
)
Thanks @dcartlidge, worked like a charm!