[SOLVED] How to attach list of things to user (each 'thing' having multiple pieces of data)

Hi all! Here’s what I’m trying to create:

  1. A person visits my page and fills out a bunch of information (all on the one page), some of which saves by auto-binding.
  2. There’s a lot of clicking of text elements and buttons that shows and hides various groups on the page. I’m using ‘parameters’ and ‘go to page’ and conditionals with ‘get data from url’ for this (I’m not sure, but this seemed to be a slightly more elegant option than simple shows and hides).
  3. At the end of all of this, I’ll give them the option to create an account so they can come back to work with their data in the future.

My question is: How do I attach all of the inputted information to the user, both before and after they register? I’ve done the lesson ‘Defining a field as a list of things - Attach a list of things to the current user’, so I know how to create a bunch of shopping list items and add that as a list of items to the user, but what if each item in that shopping list needs to have several fields associated with it, e.g. a) Item, b) Color, c) Weight?, an array within an array, I suppose (Edit: I think what’s also throwing me off is the ‘Items’ get created first, before the user has registered, and then after the user has registered, they add the ‘Colors’ and ‘Weights’ to those items).

(Along with that, I can’t figure out if I should assign a data type to the page or not. At first, it seemed like a good idea, but it doesn’t seem to jive with all of my ‘go to page’ stuff, because every time users click a button, which I’m using for ‘go to page’ navigation, the pages expects that data that I don’t feel particularly inclined to give it.)

Sorry for the length - thank you in advance!

(I would give you access to my editor, but since I haven’t been able to get my head around this, there’s not much to show you :slight_smile:

I wanted to update this in case anyone has the same questions…

Here’s what I learned. A temporary user gets created and you can assign data to them. I had read that before, but I didn’t see the user in the database, so I was confused. In the end, it seems that the user is there, just not visible in the database until they register.

Anyway, the broad overview is that even before the user registers, you can run workflows that ‘Create a new thing’ and then ‘Make changes to user’ to add that thing to the user. Then when the user registers, those things will already be tied to that user.

Alternatively (and/or additionally), before the user registers, you can ‘Set state’ to add things to (and remove things from) custom states, and then when the user registers you can add those things to the user.

I ended up doing some of each - I added some things directly to the user before they registered, which meant I didn’t have to do anything special when they registered (because the data was already added to them), but I also added some things to a custom state which I added to the user (Make changes to user) after registration. I did that to decrease workflows because that really speeds things up. I now tend to think that reducing workflows is a good thing, because a lot of times a workflow will take 1-3 seconds to run, which is too much a lot of the time. That’s why custom states are so helpful, especially when it comes to creating lists of things.

This was simple in the end. You can create the thing first and just ‘Make Changes to thing’ later to add more data to it.

I didn’t end up assigning a data type to the page. Not sure if that will ever come in handy, but it hasn’t been necessary yet.

Hope this helps!

1 Like

Hi there, can you explain how you did this - “added some things to a custom state” and “custom states are so helpful especially when creating lists of things”

I know how to set states on page elements but it sounds like you are storing a list of data in a state before you save to the db? How are you doing that?

I’m not great with Bubble, so it’s hard for me to explain it well with text and images, so I’ve made you a video. Hope it helps!

6 Likes

@philnauta Just wanted to say that was one of the best videos on custom state lists that I’ve ever seen - Wish I had that video when I first learned about them! :slight_smile:

1 Like

*Brain implodes *

I need to go and have a lie down now.

I’ve watched it twice and I’m sure I’ll get it eventually, slowly, with lots of pausing, and a stiff drink.

Update: 20 mins later a large light bulb turned on. It helps if I think of Set State as ‘save this thing to an imaginary temporary database.’ I can then have the page/group start with any kind of thing from my database in the imaginary database, then add to it, remove from it, and save it back to the actual database later on.

Thanks!

1 Like

Nice, I like that explanation.

I’m clad I found this.Really helpful.On another thing altogether, I have this complicated workflow to show and hide a group on a repeating group.So it acts like a toggle like your colors. It is just a group and is not in the database.Is there an easier way to do this?

I’m not sure I’ll be able to help, but I’ll try - can you try to explain in more detail? I’m not understanding your question.

I have a hidden group inside a repeating group and I will like to show when current cell button is clicked and hide when the current cell button is clicked for the second time.

My guess is you can do it with a simple workflow or conditional - no need for the database.

Yes !I had to set the state of both the button and the group itself.the state was numbers so it displays on a 0-1 state respectively and hide on 1-0 state respectively. i think this is too much

Can you give me access to the editor?

It is not possible because I have been invited on that app. Its not on my account. However it is working well for now.I can create on my account then share later.

Okay, good luck.

YOU ARE AMAZING!!! I have been struggling with this and finally got it to work because of this video. THANK YOU!!