I am brand new to the bubble platform and working through some functionality as a proof of concept. What I would like to do is be able to add records to a table on the screen, then once that page is submitted, create individual records for each utilizing some shared data (shift date, job number) in the backend (database). I have roughly wireframed the idea visually to hopefully help explain. Is this something that is natively possible or does it require a workaround or plugin of some sort?
Yes, this is a native feature in Bubble. You can either run a backend workflow to do this on each record that you are creating or you might even be able to do this on the front end after each time the person clicks ‘add a new entry’. You can create a connection to those entries by having a ‘job’ data type. Then connect each entry to its parent job. Does that make sense?
I will see if I can make an example for you since there are a bunch of ways to do this.
I would probably create a group outside of the repeating group with all of the inputs you want. Then, use some UI styling so it looks like it’s part of the group and create the thing only one they click a save icon.
Creating an empty thing is probably quite hacky and could lead to issues if, for example, elsewhere in your app you display counts for the Thing so the count would be off by 1 without an extra conditional to check the Thing isn’t a fake/empty thing.
Here is an example for you, I created this in view of keeping my test database clean so it stays on the free plan. This would just be an example that you can build off of for your situation. Hope that helps.
Much appreciated! This looks exactly like what I had in mind.
For clarification in the real-world use case, in the database there would be however many rows of entries that correspond to the number of entries the user created in the front end? So for example, if they entered/added 3 employees in the UI, there would be 3 new records created in the database?
From what I can tell, each addition of an entry would immediately create the record but keep it in the ‘unsubmitted’ status until the Submit button is clicked and then it changes that status to ‘submitted’. Just want to make sure I’m understanding correctly.
Yeah. That’s the way I set it up. There are a bunch of different ways to do this but this was just one way. You can, of course, adjust it to match your needs. You know your project better than anyone else.
As I’ve dug into this a bit more, I’ve run into a problem. When you add a new entry, that addition is persistent. What I need is for it to populate each initial load of the app with a single row of inputs and then allow users to add more as needed.
Here you go. This should be close to what you might want. Not sure if you want a parentJob created or not, but this is just one way to do things. You could separate the parent job with a different data type if that is less confusing. Either way, this should get you started better I think.