Add Selected Repeating Group Cells To List

Hi All,

In my app, users can create a note with a simple input form.
I need to allow them to tag the note against one or more sections.
I’ve put a repeating group in the form that dynamically lists the available sections and have a check box to allow them to select the sections they want.
In my first test I selected 2 sections for my note to be tagged to but the workflow added all the available sections instead.
I’ve since realised that I likely need to set a state based on the checkbox selection but I’ve hit a wall wrapping my head around how to do this and pass it into the ‘Create a new thing’ workflow.

Any ideas?

Thanks

1 Like

Yes, you can do this with a custom state. When checkbox is checked > set state (list state of Sections) of an element (can be the group with the form) to equal this custom state :plus item current cell’s Section.

…I can’t double-check this but I’m pretty sure your state type can be a data type… I think.

So to explain above, you’re creating a temporary list. Everytime a checkbox is checked, it adds the cell’s value to the list (current list plus new item). Even if it’s just one item or it’s the first in the list, the current list would be nothing plus the new item giving you the single item, but on subsequent items, they add on.

Then, on workflow, the section list field for your note > add list > element’s custom state.

Make sure to reset the custom state to blank whenever it makes sense if the page doesn’t change.

2 Likes

Thanks heaps Gaby! It was a little tricky at first as I couldn’t access the ionic check box in the list when setting states so I’ve replaced these with conditional icons and your instructions worked well.

Just one other thing, I’m trying to figure out how I remove a deselected item from the temporary list.
So in the case where someone clicks the wrong item, if they deselect that item, I want to remove it from the temporary list, but I can’t seem to find a way to remove the item without having to reset the whole list. Any thoughts?

Cheers

Example here …

3 Likes

Perfect! Thanks very much Nigel.

Cheers

Ok, so I have made a modification in my data model which is changing the way I need to perform this operation.
Previously, I was creating a note, selecting a list of sections to tag that note to and writing that list of sections to a list of type Section on the note.
Now what I need to do is to perform the same action of creating a note and selecting the Sections, but instead of adding the list of Sections to the note, I want to add the note to list of notes on each section selected.

Where I am getting stuck is how to shape the ‘change thing’ statement to take the list of selected sections that exists in my custom state and then add the note to the list of each selected section. Is this even possible?

Just for context, the reason why this (among a few other things) are changing is because I am trying to optimise performance and move away searching for items in my repeating groups (@NigelG - I now fully understand the concept of starting with what questions you want to ask). As such, I am looking for the most optimal solution to this problem.

Any help will be greatly appreciated.

Thanks

@NigelG - I was hoping you can help me better understand your example: https://bubble.io/page?type=page&name=tagging&id=blockexamples&tab=tabs-2

I’m having trouble re-creating it.

When you say:’ “selectedfruit” that is a list '<- what does a list mean? Is it a database entry?

I’m trying to replicate it where my custom state is a list of texts. I have been able to get it all working except removing the item from the custom state when you click on it the second time. I’m not able to replicate the “unique id <> Current Cell’s unique id” part.

Link to my app: https://bubble.io/page?type=page&name=custom-states&id=custom-states&tab=tabs-2 (red workflow is the one I’m having problems with).

Appreciate your help!

Hi there.

A lot easier now that we have the multi-select dropdown. Find it in the Plugins and use that instead ? It does much the same.

NIgel.

Thanks - that is a nice plugin. I think its the right design when asking users to choose from a large number of options. But it seems to be overkill when asking users to choose multiple from 3-4 options. Better to just show those options IMO.

Would you mind taking a look at https://bubble.io/page?type=page&name=custom-states&id=custom-states&tab=tabs-2 (red workflow) and help me get the filer constraint right when my custom state is a list of texts?

reading through Multi selection in a table based on Custom States, it looks like this filter may not be possible on a simple list of texts.

In your example https://bubble.io/page?type=page&name=tagging&id=blockexamples&tab=tabs-2 , what data type is ‘selecteditem’ ?

@emmanuel - another +1 for a ‘:minus item’ feature =)

Seems to work ok ?

what data type is ‘selecteditem’ ? It is a data type of “Fruit”.

Yes that works as expected. I was having trouble with that filter when ‘dwd option’ is a simple list of texts.

Thanks for your help!

Thanks. I’d never have found this solution.

Hi,

I am also replicating this example. For some reason I cannot see my custom state when I try and create the “Does not contain” workflow". I can see it and find it in the "can find workflow which is in green in the workflow tab.

Does anyone know why is my custom state not showing up?