Database Structure

Hello fellow Bubble users!

I am having a few issues with the design of my app’s database. I am currently creating an app for sales technicians to run various reports and machine diagnostics. Once the user signs into the app, they can add and/or edit a customer. Each customer record in the database, can also have an associated machine profile. I want to allow the user to create multiple customer profiles and create various machine profiles for each customer. However, only the user can see their own customers and machines.

How would I design this within the database side of Bubble? Any advise would greatly be appreciated!

Customer Profile

Machine Profile

1 Like

Doesn’t seem so difficult. You should have 3 database tables:

  • User
  • Customer
  • Machine

In the Customer table, 1 field you will NEED is

  • User (the user who created this Customer)

In the Machine table, 2 fields you will NEED are

  • User (the user who created this Machine)
  • Customer (the customer associated with this Machine)

If I’m misinterpreting your post, please correct me.

2 Likes

@dbevan Wow, that’s simple! I was definitely over thinking it. Thank you!!

I have one additional question. I can start a new thread if needed.

The machine profile has three different pages to complete, to keep the user from having to scroll through one long page. Is it possible to get the machine name from page one, to appear on the top of page 2 and 3? I know I can pull in “current user” data, but couldn’t find an option to pull in data from previous page.

Example

Since you’re building a mobile app, if I’m not mistaken, you’re building it on 1 page. So I’m assuming you’re referring to some “groups” as pages.

Ok, well lets say the USER just signed up and they are now ready to create a “Machine Profile”. Before the USER sees the 1st page of the Machine Profile form, you should have a “Create a Machine” workflow. The only data you would add to this new Machine is the “User” field. I don’t know your sign up process 100% but I would suggest doing this in the same workflow when the User first signs up.

*(OPTIONAL) Make the type of content for the 3 pages “Machine”. In the same workflow where you create the new machine, use “Display Data” into those 3 pages. The data would obviously be the new Machine you just created in the same workflow.

Now when you click “Next”, all of the data that has been input will be saved. Now, if you decided to do the optional step above, you can do the “Make changes to a thing” action and select something like “machine form page 1’s machine”.

If you did NOT use the optional step, you can do the “Make changes to a thing” action and search for the Machine that has a “User” field that is the same as the current user.

(Mark my first post as solved so when others go to this post with a similar problem as you, they can find the answer easily.)

1 Like

@dbevan thank you for that detailed feedback! I will attempt that and see what results I get.

Could I use the ‘Data to Send’ option at all in the workflow to send the machine name from the ‘Machine_input’ field?

image

Are you creating a mobile app?

If so, then all of your work should be on 1 page.

@dbevan it’s website based, designed for mobile though. It will all be via a mobile browser.

Oh, ok. Your design looks like a mobile app, that’s why I asked. Since you’re going from page to page, this is more interesting.

When in your workflow does the current user sign up? And when do they add customers? Later in the process I assume.

If that’s the case, then I recommend building a “dashboard” that has all of the necessary forms on one page for the user to access instead of separate pages for each form.