Copy a list of thing instead of autobinding to be able to edit or undo editing half way through

Dear Bubble community,

Please forgive me for a long introduction to my two questions at the bottom:

I use copy list of things in my app to be able to edit data in a repeating group without resorting to the auto-bind functionality:

Assume these data below are in my table, and I want to be able to edit them. What I also want is the ability to cancel my attempt at editing them and be able to get back to the initial values.
Mydata:
1, ‘Item A’
2, ‘Item B’
3, ‘Item C’

For the lack of a better idea, I do the following:

  1. Set two “variables”:
    Set State IndexEndOriginal = mydata:count ie 3
    Set State IndexStartCopies = mydata:count + 1 ie 4

  2. Copy my list of data:
    Mydata:
    1, ‘Item A’
    2, ‘Item B’
    3, ‘Item C’
    4, ‘Item A’
    5, ‘Item B’
    6, ‘Item C’

  3. Restrict the data search in my repeating group to mydata:from IndexStartCopies
    The Repeating group now displays:
    1, ‘Item A’ (#4 copy of #1)
    2, ‘Item B’ (#5 copy of #2)
    3, ‘Item C’ (#6 copy of #3)

  4. Edit these data

  5. Have the ability to save changes by deleting mydata:until IndexEndOriginal (it deletes original three entries and keeps the edited copies)

  6. Have the ability to cancel changes by deleting mydata:from IndexStartCopies (it deletes copies and keeps the original entries)

Now my questions:

  1. Is there a smarter way to do this without duplicating a lot of data?
  2. When I copy a list of things, I notice that the copies do not necessarily respect the order of the originals ie
    copying 1, ‘Item A’ 2, ‘Item B’ 3, ‘Item C’ would be:
    1, ‘Item A’ 2, ‘Item B’ 3, ‘Item C’ 4, ‘Item C’ 5, ‘Item B’ 6, ‘Item A’
    instead of:
    1, ‘Item A’ 2, ‘Item B’ 3, ‘Item C’ 4, ‘Item A’ 5, ‘Item B’ 6, ‘Item C’
    Copy a list of things, copies things in which way theoretically: ascending (or descending) order of created-date, modified-date, primary-field?

Sorry for the long text.

Hi there!
I think there’s an easier way to do this. Instead of using auto-binding or making a copy, you could simply have the inputs on the table have the original data showing through the “initial content” option. Have the inputs be open so the user can make any changes he/she wants. You can then have two buttons, a save button or a cancel button. Since the inputs are not using auto-binding the changes to the database need to be made using a workflow which can be activated through de save button. If the user decides to not save the changes to the data and revert back to the original data, he/she can simply press the cancel button which resets the input, the database is still intact, so this would show the original data.

2 Likes