Data structure for subfields

Hello. I am sorry if my question is not smart. I still learning bubble.
If i have a data type “property”, and one of it’s fields is “property insurance” that is also a data type and has a 3 fields. I cannot just create a “property” thing with “property insurance” in one step in workflow? I should create “insurance” thing first and then add it to a “property” as a result of step one? Is there any simpler way?

Thank you for the help!

Hey @ForeverLive :wave:

Welcome to the Bubble Community :tada: :confetti_ball:

That is a very common thing. You would just have two steps in the same workflow. That is the simplest way to do it. Trying to do it in one step doesn’t really work since you have to create two separate things and then attach them somehow. Usually with a ‘parentProperty’ or something like that. Does that make sense? :blush: One workflow, two steps to it.

1 Like

Hello, thank you for the reply. What if i got unknown amount of “property insurances”? How i can create a workflow where i don’t really know how many things i want to attach to “property”?

If you are uploading properties and a list of insurances from a csv or something, you would need to use a loop on the backend workflows to create as many are needed.

Is that what you mean? Can you share more info on what you are trying to do so we can assist further. :blush:

1 Like

I need to make a process where user adding floors to a building. There could be unknown amount of floors and each floor is a thing with own fields. Also floors can be negative. I don’t know how to loop “floors” creation and add them to building, since i cannot create building “thing” while i don’t have floors and i cannot add “floors” to “building” thing inside of a backend workflow, since “building” is not exists yet, and backend workflow cannot be referenced as “result of previous step”.

You don’t need to apologise for your questions. We were all learning Bubble at one point! I can look back on my first questions and be like ‘how did I not know that’ but only by asking can we actually improve!

Normally, you’d do this by the following:

  • generate list of numbers (minimum floor → maximum floor e.g -2 → 9)
  • Schedule API workflow ‘create floor’ on list of numbers
  • Have a backend workflow called ‘create floor’ which takes a number parameter (the floor number), and probably a Building parameter (the building it belongs to)
  • Inside the backend workflow, create a new Floor (using the parameters passed into the backend workflow).

Essentially, we have a function: create a new floor with a particular number and building. Schedule API workflow on a list of numbers says ‘for each floor in this list, create a new floor’.

2 Likes

Thank you for your reply! This is makes sense, but how i would generate a list of numbers? Is it a custom state or separate thing?

There’s a plugin called Toolbox which has an element to do this for you!

2 Likes

Thank you, this is a great plugin. I don’t really understand how to use it, but i will read documentation and get it.

Hey there @ForeverLive, I’ve created a video for you on how to add units with the SWOL (Schedule Workflow on a list) using the Toolbox List of Numbers to generate them for you, based on user input.

1 Like

Wow, thank you! This is exactly what i needed! You are the best.