I have created a select box that successfully filters based upon the selection using the following.
SELECT Products.product_name, DailyWork.due_date, WorkAssignments.cartons_assigned
FROM WorkAssignments
JOIN Crews on WorkAssignments.Crews_id = Crews.id
JOIN DailyWork on WorkAssignments.DailyWork_id = DailyWork.id
JOIN Products on DailyWork.Products_id = Products.ID
WHERE WorkAssignments.Crews_id ={{SelectCrewFilter.selectedItem.id}}
This works ok, but was hoping to have it just display all results when there is no selection made in the select box. Right now, it is correctly displaying nothing because it evaluates to null. What is the proper way to change
WHERE WorkAssignments.Crews_id ={{SelectCrewFilter.selectedItem.id}}
So it'll show all results until a selection is made and then filter
Thanks for this! I am still really new, where would I actually put this Javascript? I have modified it for my data, but not sure where to actually put it in the retool gui
You would trigger the two different queries where my return statements are. You know where you select your SQL query? Select a JavaScript query instead and slap that in. Then on the button to trigger your SQL query instead trigger the JavaScript query.
Everyone has to start somewhere, we started in retool a few months back and were slamming our heads against the wall at first. Once you build a couple apps and/or get some really advanced queries running it will all start to click.