-
Goal: Have a ticketing system and table setup, but I want a form that works through a few tables in retool database that are linked by foreign key. I want the user to be able to select through the tables before submitting a ticket.
-
Steps and Details: Let's say I have the following tables in retool database:
Sites
site_name, site_id
Areas
area_name, area_id, site_id (linked to Sites)
Items
item_name, item_id, area_id (linked to Areas)
And then I have a table for Tickets that links to an item_id in the Items table.
I want a form to add a ticket where the user first selects a Site, then selects from a list of Areas based on that selected Site (filtered by site_id), then selects an item based on the selected Site, then fills out ticket info and submits.
I have a table for the tickets and a form to enter a new ticket. I have a select component where the user can choose an Item and my form uses the item_id when submitting the ticket. So, that works as intended. I don't yet, however, have a good plan on how to limit the item choices by having the user select an area and a site first. I have three select components (Sites, Areas, Items), but It isn't clear to me how to 'hide' choices in the Areas select based on the selection made in Sites select. Or, perhaps there is a better component/method? I guess I was thinking of using a query to populate the areas selector, but need to wrap my head around passing in the site selection to the query. I'll play with that now...
Edit: Ok, I worked on this and I think they will work. Area select gets its mapped values for the user to choose from via a js script that filters the table data based on the Site select choice the user makes. I'll do the same for Items and I think I'll be all set. But, would love if there are more elegant solutions/ideas
I appreciate any time and thoughts!
Thanks,
Brady