Is there away to save things to be added to thing that is not yet created?

I’ve hit my head against the wall.
I’m trying to make the structure for a small app that creates materials.

Its a very simple setup there are bunch of input boxes for name, style number etc.
My problem arises when I have to the material composition.

I sofar only have a popup with percentage field and a drop down where the user will choose the differnet fibres loaded into the database and a repeating group that should show each line of percentile fibre.

Fx a fabric could be:
50% Cotton
20% Wool
20% Polyseter
10% Silk

However I can’t get this to work as I have nothing to attach the composition lines to as the main material is not yet made as it’s still in the ‘Setting up’ process.

Does anyone know if there is a way around this?

There’s a few ways to approach this kind of thing, largely depending on your database setup and exactly what you’re trying to do…

One way is simply to create a new ‘thing’ first, then you can attach all the data directly to the newly created thing, either through autobinding, or with workflow actions. Then if the process gets cancelled simply delete the thing. If you’re worried about having half-finished objects in the DB that were never completed you can run a backend workflow every so often to clear out incomplete objects.

Another way is to store values in custom states, then add them all to the new ‘thing’ at the end when the thing is created.

But also remember that inputs, and repeating group lists, effectively have their own states (their values) that will remain until they are reset, so often there’s no need to create additional custom states.

So whatever is entered into your inputs, and set as the datasource for your repeating group, will remain there until they are reset, either by a page refresh or a workflow action, even if you use multiple steps in your forms, even if they are not visible on the page.

So you can simply wait until the end of the ‘Setting Up Process’ then save all your database data in one (or 2) final workflow steps.

1 Like

Thank you @adamhholmes
I tried a to add the values to custom states - but had no luck, hence I posted in here.

But it is entirely possible that I’m not doing it the right way, you wouldn’t happen know a ressource where I can see this done properly?
I imagine this is a useful thing to know how to do.

Other than the regular Bubble tutorials I’m don’t know off hand any specific resources that explain this.

But from what you’ve posted so far it’s not clear exactly where the issue is you’ve having, and without knowing your app in more detail I can’t really give any specific guidance.

But, as I said before, the inputs themselves hold their values until you reset them, so there’s no particular need to complicate things by creating additional custom states - you can reference the input values when you need them (i.e. when you create your database object).

The same applies to a RG’s list of things - once it’s set it stays set until it’s either reset, or changed.

So, for simplicity, lets say you have 2 datatypes

  1. Material
  2. Fibre

A Material has a name and list of Fibres
A Fibre has a name

You can set the Material name in your ‘Name input’

Then you can open a popup, select Fibres from a dropdown, and add them to a repeating group list.

Then when you’re finished, run a workflow on a button click to create a new Material with the Name being the value of the Name input, and the list of Fibres being the Repeating Group’s list of fibres.

If you want to store different percentages for the fibres on each material then you’ll need to create a 3rd datatype, that connects a material to a fibre, as well as having a field to store the percentage, but the overall process is the same.

You can make it as simple or as complex as you like, but as long as you don’t reset any inputs or clear any RG lists, all the data will be there ready to create the new database entry at the end.

Then, just clear the inputs and RG lists and you’re ready to go again.

1 Like

Why don’t you catalog all the fibres as an Option Set?

@rpetribu because each fibre needs a little bit of information to go with it aswell each fibre have different attributes such as recycled, or a certification. I think option sets does not allow for this?

No…
So you should create a database just for them… and load it when creating a material

@kim3

You can add attributes to options sets.

The only drawback is that you cannot change them dynamically or add/delete them. Only manually in the editor.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.