Filter on comparison between fields

I have a table in Supabase with 2 number fields and would like to create a collection with the filter condition [field A] < [field B]. Is this currently possible in WeWeb?
If not, I would welcome any ideas for a workaround.

Sadly it seems it’s not possible natively with supabase

But it should be possible if you develop your own postgres or edge function, still more advanced.

An easier way to achieve it would be to build a formula that will return your collection and apply a front end filters, maybe by using javascript. You can ask Copilot for this :slight_smile:

Thanks @Alexis! I used a postgres function as a workaround which is working well.

If anyone finds this and needs the function, here it is:
BEGIN
RETURN QUERY
SELECT table.id, table.name, table.comparisonfield1, table.comparisonfield2
FROM table
WHERE table.comparisonfield1 < table.comparisonfield2;
END;

1 Like

Wow that’s great, well done!