Update a list item in repeating Group

Hi Bubble Experts
I am creating a function to update the content in a repeating group. However, whenever I update an item, the updated item appears at the bottom of the list. This happens because I remove the original item and add the new content to the end of the list.
Is there a way to maintain the original order of the items in the list after updating an item? I pasted the bubble editor below and see if anyone can give me some ideas to fix this issue.

My bubble editor link is : RG_List_Update | Bubble Editor

Demo video

Hi! I just made an update in your editor if you don’t mind.

Instead of add, and remove that was there previously, I’ve used the set list command. Now the idea behind this:

Example: you have a list with 1,2,3

  1. I get the list of texts and merged them together, and form a single string, merged with |||. So now, it’s
    1
    |||
    2
    |||
    3

  2. I do a find and replace. Find the current text you’re updating and update it with the text in the input. If you’re updating 1 to 4
    4
    |||
    2
    |||
    3

  3. Split by ||| so that it becomes a list again

I hope this approach makes sense. Also, you might face an issue in case duplicates are stored in the list since it’ll find and replace all instances of the text. So you can store the timestamp as well along with each text and just show the text, and not the timestamp with it.

Hope this helps :slight_smile:

Hi Zeroic

Thanks for your prompt reply. It works!

You save me a lot of time.

Amazing, no problem. Glad that this worked :smile:

This topic was automatically closed after 70 days. New replies are no longer allowed.