Hello fellow retoolers.
Please consider the following scenario:
I have three tables in my PostgreSQL DB - 1. Lines, 2. Clients, 3. Subscriptions.
Each subscription is made of a relation between a line and a client.
When adding lines into the database there's also an option to automatically create a subscription for the inserted lines with the given client.
The problem? Wehn trying to create a subscription I need to know the line_id of the line that were just inserted and it's not possible with the GUI mode.
If I was using regular SQL query I would’ve done in like this:
WITH ins AS ( INSERT INTO lines VALUES (default, phone_number, sim_number, ...), (default, phone_number, sim_number, ...), (default, phone_number, sim_number, ...), (default, phone_number, sim_number, ...) RETURNING id) SELECT array_agg(id) INTO line_ids_list FROM ins;
And then I would have another query that is in-charge of inserting the rest based on the returned ids.
But since for bulk update I have to use the GUI Mode, then I can't think of a way to pull this off inside of retool.
Any help would be greatly appreciated !