Hi,
I'm trying to filter an Item collection in my mobile app.
I have a text field looking for serial number and customers.
I also want a date picker to filter further much.
But If the date picker is empty it needs to ignore the filter.
this is my Query
SELECT
"Inventory"."ID",
"Inventory"."BarCode",
"Customers"."Name",
"Volumes"."Description" AS "VolumeDescription",
"Inventory"."ReceivingDate",
"Locations"."Description" AS "LocationDescription",
"Inventory"."DeliveryDate"
FROM
"Inventory" AS "Inventory"
LEFT JOIN "Customers" AS "Customers" ON "Inventory"."CustomerID" = "Customers"."ID"
LEFT JOIN "Volumes" AS "Volumes" ON "Inventory"."VolumeID" = "Volumes"."ID"
LEFT JOIN "Locations" AS "Locations" ON "Inventory"."LocationID" = "Locations"."ID"
WHERE "Inventory"."BarCode" ~ {{ searchInvItemCollection.value }}
OR "Customers"."Name" ~ {{ searchInvItemCollection.value }}
AND "Inventory"."DeliveryDate" IS null
ORDER BY "ID" DESC
I tried adding this but it does not work
AND ( {{ !dateFilterInventory.value }} OR "Inventory"."ReceivingDate" = {{ dateFilterInventory.value }} )
The date is never empty / null in the database. that's why I need it to skip the filtering If the component is empty