I see. I’m certainly a big fan of simplicity, but I’m a bit unclear as to why two separate records are needed for each line item. Could a single record with a Status field be used - i.e. just change that field’s value from “draft” to “final” when the invoice is saved/finalized?
Let’s think that a user creates a new invoice but then after, he wants to edit the invoice. If he modifies the values of the line items he is actually touching the status yes so even if he does not save the invoice, he is actually modifying the line items.
Because of this what I do is whenever a user edits an invoice, I duplicate the line items and set them as draft so if the user touches those line items and then leave without saving, the valid lines won’t be affected.
load the list of invoices onto the page as a custom state.
Create a form within a RG that shows the invoice, with the initial value coming from the custom state.
When the user modifies the form, they must click “save”-- no auto binding. Since every RG’s cell contains one invoice, you can just make changes to that single invoice when the user finishes editing a draft.
you can also opt to display the information as a popup as well, and send a different RG cell’s invoice into the popup.
This way, you are never making changes to any list, and there shouldn’t be a load time.
I see-- let’s say you have a page to show a single invoice, and that the Invoice data type contains different things and lists of things.
You can load a single invoice onto the invoice page, and save it somewhere (let’s just call this the custom state), and populate the page with dropdowns and inputs. The initial value of every input and dropdown/multidropdown are the things and lists of things from the invoice stored in the custom state. (you only have to load the invoice once).
The user can then edit the invoice by modifying the inputs-- nothing happens to the DB.
When “Save” is clicked, you can create a new invoice with the values stored in the inputs/dropdowns. If you need to modify the invoice in the custom state, you can also run corresponding workflow actions when the user presses “save”.
I think this is not necessarily about cutting out the bubble DB, but rather minimizing the amount of times you have to search/load stuff in and out of it
Despite a bunch of pretty smart people chiming in here in this thread, what the OP is trying to do is NOT easy in Bubble, even though it should be.
We have no access to Things (objects) except by interaction with the database and in the OP’s case, parallel lists contained in multiple Custom States IS NOT viable (due to the set-like nature of Bubble lists). This is somewhat more manageable if using List Shifters instead of custom states, but it is still likely the OP will run into issues with null values in their parallel lists.
Because of all this, I did start on making a plugin specifically for use cases like this, but it’s not quite ready for prime time. (I posted a short video of this a while back.)
Cheers for sharing my video. This is a bit of an old version with a step missing, take a look at the more upto date version below. This focusses on front-end looping by putting line item data in custom state lists and writing to the DB only at the end. It uses @keith 's ListShifter for looping.
Thanks to all for your suggestions but as @keith said, it´s not easy to do this kind of thing and I´ve been searching to do it since the beginning with Bubble but at the end I always ended up to touching the database because of how Bubble handles lists. There are so many things to consider indeed, just for line items.
@keith Yes, I would love to try it out the beta version of your plugin since this thing is something I´m trying to deal with every year with no luck. PM´ing you right away.
Just curious how many line items there might be. Hundreds? Less than 100?
I’m still not sure I understand the intended UX, but if you need to iterate over a RG, I assume you’re aware of @vini_brito’s Orchestra plugin (original announcement here).
I’ve not used it, but I believe it would allow you to run a workflow for each cell (and thus access/save each line item’s input values, etc.) Of course, there’d be an http request for each line item, but if that became an issue, you could probably get around it by using auto-bind and scheduling an API workflow on a list.
Hi @ryanck - no, that’s just a very simple plug I did for Stu’s specific problem. If you PM me the bubble name of your app, I can give your app access to a beta version of my cart/parallel list plugin.