Change the value of a specific item in a list

Please direct me if there is already an answer as I have not found one yet :slight_smile:
I have a list of yes/no’s where I want to change one item to the other value.
e.g. In a data table I have an item which is a list of names and another item which is a list of yes/no’s.
(they cannot be separate records) I have two repeating groups, one showing the list of names and the other showing a list of checkboxes reflecting the current yes/no value. Let’s call this list “Confirmed”.

I’m trying to perform what should be the simple task of changing person number 3 in the list from no to yes when the box is checked.

How do I locate the item number in the list according to the repeating group’s index and change the value from no to yes OR yes to no?

Hi @shane.archer!

Use one repeating group and set the source as your data table. Then, when you update the checkbox you can specify in the workflow to update the current cell’s item. You could also set it as binding for it to automatically update without workflow.

⠀⠀⠀


If this solved your problem, please click Solution under this comment.

So I was able to play around with this more today and in thinking about it, I think I posed the question wrong. Telaholcomb, I understand the answer you gave as I understand repeating groups pull a list from a data table. That’s pretty simple. BUT I realise the correct question is actually, How do I change a specific value in a Multi-Value field? That’s changes things a little.

For a little more clarity the table looks something like:
(Item Name), (Item Date), (Multi-Value), (Multi-Value), (Multi-Value), … other single fields)

The multi-value fields are person’s name, person’t number and confirmed. I have three repeating groups that pull up the multi-value fields which all work. What I want to happen is when say person #3 in the list confirms, I check a box and item#3’s value in that multi-value list changes from “no” to “yes” (and visa-versa)

Because it’s a multi-value field, binding will not work. (at least I don’t think so).

Hey Shane. What do you mean by “multi values”? Could you provide some screenshots?

Multi Values is a field option when you create a field in a table. It means that field can contain multiple values in a list.
MultiValue

As opposed to a single value:
SingleValue

In this sample you can see an Event Name with the next field being a list of yes/no’s (for Confirmed) and a list of names.
Sample

Yeah this is a bit tricky. I think the way to go is to use a plugin to extract the values as a list, outside of the repeating group. Some options would be the Orchestra plugin (free but some work to setup) or BDK’s RepeatingGroup Tools (paid but straightforward).

Once you have the list extracted you can just overwrite the old yes/no list with the new values.

Obviously having each crew member as a separate Thing would make this trivial, but I gather that is not an option from your previous post.

Crewmember thing
Name etc

Crewmember Availability thing
Crewmember
Event
Available Y/N

(so a many to many)

I can’t think of a good reason why having two lists and trying to update item #x in list A based on a search of List B’s item # is the right thing to do.

The only reason to do that is because you did it wrong in the first place. Sort that, and everything else will be simpler :slight_smile:

2 Likes

Thanks for the responses! Maybe I’ll back up a bit here… I built the tables this way to be more efficient with the data. So here’s a general overview of the why’s (and maybe there’s a better way)

Crew members are registered users of the App so I can’t really have a separate crewmember thing. The registered users contains their names, numbers and an “Event” list (which is how the app knows what events they are assigned to).
I then have an Event Thing which contains all details about an event including what crew is assigned to it. There can be multiple Events with the same crew member assigned to each of them.
I chose to use lists in the Event Thing for assigned crew to prevent the table from growing too big. I.E. 20 Events with 30 crew each suddenly makes that data table 600 records.

When a crew member logs in they see the events they are assigned to: (From the registered users Thing)
Sample1

They click an event and see the details (from the Event thing)

On the Admin side, an administrator can confirm crew (listed from the Event Thing)
Sample3
(“no” is the current value of that item in the list)

Hopefully that gives a clearer picture of why I’m trying to do it this way.
I might try a plugin as robhblake suggests but it there’s a better way I can try that too :slight_smile:

I am still right :slight_smile:

@shane.archer Yeah I’m with Nigel on this one - think you would have an easier time working with your data if the database was structured differently. The plugin approach is a bit hacky, not the way Bubble is meant to be used.

So in my mind you will have two data types:

  • Users (can segment between Crew and whatever other type of user you may have)

  • Events

Have a field on the Event for Confirmed Crew (being a list of Users). You can also have a field Invited Crew (being a list of Users). So for each event you can easily display a list of crew members associated with the event (using the Invited Crew list) and by comparing that list to the Confirmed Crew list you can get a list of who has / has not confirmed.

Hope that is clearer? I can do up an example later if more helpful.

I was able to do this using the Flow State List SSA action from the List Popper And Friends plugin.

It’s a bit complicated, but here goes:

  1. Store the current list using Flow State List SSA.
  2. Store one LESS than the current index in the RG for the item being changed, using Flow State Value SSA.
  3. Store one MORE than the current index… using Flow State Value SSA.
  4. Clear the current list.
  5. Add into the list the items stored in Step 1, but only those items up until current index - 1 (stored in Step 2.
  6. Add into the list the changed value.
  7. Add into the list the items stored in Step 2, but only those items from current index + 1 (stored in Step 3.

Hope this helps someone in the future.