How to filter table based on multiselect value inputs

Hello,

I am very new to ReTool and need some help filtering a table based on the multiselect inputs. I would like the table to display all rows if nothing is selected, then only show rows that match the selected value(s) in the multiselect component.

My data is drawn from a Google Sheet.

This is what I have so far:

function SelectInputs(value) {
if ({{multiselect1.value.length === 0}}) {
return value.Operation !== ""
}
else {
return value.Operation === {{multiselect1.value}}
}
};

return data.filter(SelectInputs);

This Transformer query works when there are no inputs in the MultiSelect component, but is empty when anything is selected. I would also like to note that the only values in the multi-select dropdown menu were mapped with {{item.Operation}}.

I have been stuck on this for a while. Any help is appreciated. Thanks!

Hi @cdiep!

You might need something like this:
const selectedValues = {{multiselect1.value}}
function SelectInputs(value) {
if (selectedValues.length === 0) {
return value.Operation !== ""
}
else {
return selectedValues.includes(value.Operation)
}
};

We also have other post from the Community page about Dynamically filtering tables you can check out in case you haven't yet.