Can a group have data independent of the database?

The more I learn about Bubble the more awesome I find it, but there is something that constantly troubles me.

Quite often I want a group to have data before I create a record and commit it to the database.
It seems at the moment you have to create a thing and then change it in the database.
But if the user abandons the update half way through you end up with crap in your database.
If a group had its own copy of the data that could be checked for completeness before making the commit.
I have tried this with states but updating complex states doesn’t seem to be an option.


I have the same concern, but I don’t think it’s possible. If you have a simple form with various input elements, you can wait to create the data when the user submits. But if your form has input elements in a repeating group, you have to create the data first and then auto-bind or trigger a workflow when input has changed…

Thanks Soeren. I was hoping I was missing something but I think, maybe it’s bubble that is.

Hold up. I really don’t get why this isn’t working.
Subject: adding a google book (gb) to a bubble book (bb) database.

stage 1: Title input, Author input. Button loads gb into Repeating group. = works fine
stage 2: click cover in gb repeating group >
make changes to a thing = bb custom state ( same as bb database) of bb group
bb(title) = gb(title) bb(author) = gb(author) etc
display data bbgroup (bb custom state data)

big fat nothing.
No error messages anywhere to be seen.

It is usually quite difficult to determine problems from just descriptions. If you could provide a link to the editor it may be easier.

Not sure I quite follow the initial issue, however. Seems to me there are several ways to implement what you want, depending on the needs of your users.

Save a copy of the record being added as “draft” and only update this to “live” when the user hits “Save”

This also allows you to tidy up if you want to, and give a user coming back to a mid-edit item the choice (a bit like word’s autorecover).

Or save the repeating group information in a custom state, and then “set” using that state when you save. I use that frequently when I want the user to be able to add and remove items from a list before they save.

1 Like

Hi Nigel, I am trying to save the data to a custom state but saving data to custom states (same type as database) seems to be a dark art. The set state update value box seems to expect a logical value not data and provides no means to access each element of the record, while ‘make changes to a thing’ in theory connects to the data elements (the editor accepts it all happily enough) but at run time the state tests as empty. Any hints gratefully accepted. This is so tantalisingly achievable it drives me nuts.

Yeah, questions like that are best answered by just letting us look at your editor.

Custom states are unrelated to database records. You might have to create a custom state to correspond to each field on the record you want to create at the end. When you build the expression to set the custom state you should be able to access all of the data on the page.

“Make changes to a thing” is going to change a database record, not a custom state.

Thanks Blueback09,

I don’t want the group data to be committed to the database until the user commits to the record, otherwise I end up with garbage (incomplete and unwanted records) in my database. That’s the point, and I believe a rather significant flaw in bubble.

You are probably right. Although the editor lets you set a group’s data source to it’s own custom state (using the database type) and “make changes to a thing” of the custom state shows blue not red, it doesn’t actually work at run time so as you say I will probably have to set multiple custom states, which is untidy and nothing like as elegant.

It is frustrating though because if I was programming in javascript I could simply go “instance = new object;” and it would store data until I chose to commit to the database. It’s kind of normal to update data to a database only after you’ve validated it, not because you might need it.

Store where ?

otherwise I end up with garbage (incomplete and unwanted records) in my database.

Depends on your user case. That might be something the user would want later (in which case you can recognise it and present a “Hey, it looks like you were entering this last time… do you want to continue” or just delete it.

“Garbage” is also useful analytics, if you are getting a lot of unwanted half completed records … it is better to know about it, surely.

Bubble offers several ways to deal with this.

Firstly, you can create the thing in advance with a status, and update it as you go along. Then change it from “draft” when they commit. This means the user’s data is not lost. And you can just clean it up daily if you don’t want it.

Secondly, you can store it locally using custom states. What you can’t do is a have a local version of an “object”. That is certainly true, a little frustrating, but by no means a disaster.

So a Custom State of type “Invoice” needs to be an Invoice that exists on the database. You have to have the component parts of your invoice first, then create the thing on the database.

We can deal with input fields. We can have lists of texts that you can manipulate. We can have lists of other data in our database - so a list of expense codes.

So we can do both patterns within bubble, optimistic and pessimistic. Agreed they both take a bit of work to achieve (just like doing record locking etc) but it is possible as far as I can see. Unless you have a particularly complex requirement, in which case am interested to hear about it !

Hi Nigel,

Store where? In application memory just like any other state.

The scenario is a search of google books feeds a repeating group. clicking the cover of the repeating group identifies the google book to another group so you can read more about it etc. But when I set the second group data source as the database of (non google) books I ended up with lots of incomplete book records when I clicked around the repeating group looking at different versions of the google books. All I wanted was to inspect the google books details more closely in the group, not convert them for inclusion in the bubble database.

My main point is that the editor did not tell me the approach I used ( setting the group data source to its own custom state and manipulating it with ‘make changes to a thing’) could not work.

I have used Blueback09’s suggestion of multiple custom states and it works as required now.

But from a philosophical point of view I think it highlights a need for custom states that can be manipulated by “make a change to”. The bubble approach is sometimes too optimistic.Yes, I get that the idea is to make it impossible for users to enter wrong data by catching errors before they make them by making them impossible but I think creating a record in a database in anticipation that it might be needed is 1) too resource intensive, 2) requires too much clean-up to catch erroneous database entries and 3) plain ugly. Just my opinion.

Ok, cool. Glad it works for you.

Good that the multiple custom states is working for you.

I know it’s more complex, which might not be worth it right now, but Nigel’s right that you probably will want to know what people are doing in your form. If you make a table for “in work” form data it will help you troubleshoot problems and gain insight through analytics. It will also allow you to preserve “in work” data even if something goes wrong, so the user can pickup where they left off.

edit: oh yeah, if your problem is solved, best to mark the thread as solved, even if discussion continues.

" if your problem is solved, best to mark the thread as solved, even if discussion continues"

not sure how to do that.

There should be a little box with a checkmark near the “reply” button on the posts. If you started the thread you can mark one of the replies as “solving” the original question.