Hello.
I am trying to make a Filter in a Form with a ListBox of “Workers” and I get success filtering when selecting a worker and refreshing a form. But I would like to show all the workers when selecting something like a “All workers” item.
In the Listbox I can see the list of all the workers and the first value is something like a “blank” or NULL or EMPTY ( I am not sure. I can set this in the cell where it is stored the data).
Then, I was thinking that when this “NULL” value is stored in the filter cell, then would be great that when I run a query that doesn’t filter by worker, something like a condition after the “WHERE” statement.
I have been searching and in HSQL docs says something about CASE or CASE WHEN, but when I try to run a query doesn’t recognize CASE. Something like this:
SELECT “Worker_ID” AS “SelectedWorker” FROM “Filters” WHERE “Filter_ID” = ‘0’
CASE “Worker_ID” IS NOT NULL THEN SELECT * FROM “Assets” WHERE “Worker_ID” = “SelectedWorker”;
ELSE SELECT * FROM “Assets”;
END CASE