Keeping track of each user's item selections from a central database

I have a database where a logged in user will select a series of items. For my purposes I initially created a Yes/No field so that when an item is selected, I can perform an action based on this. The trouble I see is when I have more than one user. They can’t both set this field otherwise everyone would be messing with everyone else’ selections.

How would I go about identifying which items in a central database an individual user selected, then use this information on a web page that fills in uniquely for that user?

Hi Chris,

You can create use a custom state to store this Yes/No field for the selected item. A custom state is a way of storing information temporarily on the page that will be used to make calculations or set off workflows. You can store a custom state on any element in Bubble.

In this case, if you have a list of items, you can click on a group which the individual item is inside, in the popup window which has this group attributes, select the “I” icon and select “Create a new State” you could name this whatever you want for example “selected?” and then set this data type as yes/no

Now you can run an action when the group of this item is selected in workflow section search for “set state” look for the name of this item’s group and then look for the name of the state you created in the second dropdown for example “selected?” and set this value to Yes or NO

You can create a condition in the only when section of this Group Item is clicked, search for the Group Item’s selected? is “yes” then run the workflow to set this value to “no” and in reverse if Group Item’s selected is “no” set this value to yes

Any additional workflows you want to add to the page when the item selected is “yes” can be added here inthe workflow section.

Now you are no longer storing this yes or no value in the database and it will be unique for each user that comes to your website

I hope that helps! :slight_smile:

For in-depth Bubble.io video tutorials click here

Thank you, that looks like it will work for the session, but in my use, these states will need to be available each time the user logs in. How is that possible using states? Is there some way to save these states for the user so they’re available when they log in again?

To add additional information to the issue, currently, I use this database Yes/No condition to build a menu using a Repeating Group. There is a Constraint on the RG to display a list of selected items when the database’s field is set to “Yes”. If I can capture the users selection on the list page, save it for future sessions (unique to each user) AND use it to build the menu on another page, then I’m golden.

In the listing image below, I highlight a user’s selection by covering the image with a semi-transparent light blue square. The selection is then used to build the menu shown in the second image.