-
Goal: I want the query to show all the data automatically especially when I have it set to run when inputs change. Right now, it's only showing after I toggle the filters.
-
Steps: I've removed most of the filters, I found that the issue occurs when I have select component as filters. Even if I set a default value for the filters, it doesn't run correctly. I almost have to "wake it up" but toggling the filter settings. This seems to only happen on some of my queries, other ones with similar mirrored queries work fine.
-
Details: I am on Cloud, using the select, multiselect, and daterange components as my filters with a table connected to a RDS SQL query. Here's my query
SELECT
w.id,
w.mtn,
w.line_num,
w.name,
w.container_no,
w.container_size,
w.total_q,
w.unit,
p.id as product_id,
w.notes,
w.description,
m.job_id,
m.status,
m.date_pickup,
m.date_delivered,
m.facility_name,
m.generator_name,
CASE
WHEN m.haz_status = 'Non Hazardous' THEN m.date_pickup + INTERVAL '365 days'
WHEN m.haz_status = 'Hazardous' THEN m.date_pickup + INTERVAL '10 days'
ELSE NULL -- Handle other cases as needed
END AS max_disp_date
FROM
wastes w
LEFT JOIN
products p ON w.product_id = p.id
LEFT JOIN
manifests m ON m.mtn = w.mtn
WHERE
m.status IN ('Delivered', 'Invoiced') and
(m.date_delivered BETWEEN {{daterange_filter2.value.start}} AND {{daterange_filter2.value.end}})
AND (w.product_id = ANY({{product_filter2.value}}) OR {{product_filter2.value?.length}} = 0)
AND (m.facility_id = {{facility_filter2.value}} OR {{!facility_filter2.value}})
ORDER BY
m.date_delivered DESC;
This similar query works fine:
SELECT
w.id,
w.mtn,
w.line_num,
w.name,
w.container_no,
w.container_size,
w.total_q,
w.unit,
p.id as product_id,
w.notes,
w.description,
m.job_id,
m.status,
m.date_pickup,
m.date_delivered,
m.facility_name,
m.generator_name,
CASE
WHEN m.haz_status = 'Non Hazardous' THEN m.date_pickup + INTERVAL '365 days'
WHEN m.haz_status = 'Hazardous' THEN m.date_pickup + INTERVAL '10 days'
ELSE NULL -- Handle other cases as needed
END AS max_disp_date
FROM
wastes w
LEFT JOIN
products p ON w.product_id = p.id
LEFT JOIN
manifests m ON m.mtn = w.mtn
WHERE
m.status IN ('Picked up', 'Shipped', 'Delivered')
AND (m.date_pickup BETWEEN {{daterange_filter.value.start}} AND {{daterange_filter.value.end}} OR {{!daterange_filter.value.start}})
AND (w.product_id = ANY({{product_filter.value}}) OR {{product_filter.value.length}} = 0)
AND (m.facility_id = {{facility_filter.value}} OR {{!facility_filter.value}})
AND (m.status = ANY({{status_filter.value}}) OR {{status_filter.value.length}} = 0)
ORDER BY
m.date_pickup DESC;
- Screenshots:
I can DM my export to whoever is helping, I don't want to post my app live on forum.