Forum Academy Marketplace Showcase Pricing Features

Move items between repeating groups

Hi!

I’d like to move items between repeating groups on a button press or checkbox action. What would be the most effective way to do it?

E.G. I am setting up a zone for access control and trying to add users to it on the same go, but before the zone has been created. So I have the list of users that can be added and I’d like to make another list of the users to be added, that is created from the first list.

So the page has two repeating groups side by side. One of them is populated with a list of users, another has also a type of user, but is empty for starters. All the fields in the first repGroup have a “+” button and in the second one a “-” button. When the + is pressed the user should move from the first to the second list. And vice versa on the - press.
Then when the “create zone” button is pressed only the users in the second repGroup should be processed and added to the newly created zone.
Sounds logical(to me) but I can’t find a way to move the users like that and filter the group display based on another group’s list of items.

Is there a future in making this action work or should I rather break adding users down to a separate step?

Thanks!

1 Like

You could do this with a couple of custom states driving the repeating groups. Similar to …

However we had a few performance issues.

Ooohkay, thanks @NigelG .

I think I made it a bit simpler.
I created a new data type called TemporaryList with a field for name and then a list field for every necessary data type I have.
Then, as the relevant page gets loaded (when Popup is opened) a TemporaryList with a specific name gets created and the relevant data is saved there until popup close causes the deletion of the TemporaryList (via search for the specific name and creator).
Then one repeating group is based on a preset list of things and another is populated by the TemporaryList. Then it’s just a simple matter of creating buttons to the respective cells to add or remove the cell’s thing to and from the TemporaryList.
Stuff started working as needed, but the problem there is probably garbage collection when the browser is closed before the popup.
A time-based workflow that runs every now and then to clear all the TemporaryLists older than 60 minutes could solve that, though.
Another issue is that I can’t find a way to filter the items present in the second repGroup out of the first one…

Any better ideas and/or criticism for this solution?

Okay and now I have another question.

How would I use all the elements of the aforementioned TemporaryList to create another Thing for each of them?

E.G. when adding a list of users to the organisation, I’d like all of them notified about it. This is usually done with an “event” Thing that carries necessary messages in the system and also makes up a logging system. Now, when bulk adding them to the organisation, how should I create a load of new events for that? There was some talk of iterating becoming possible?

That’s quite tricky. Will have a ponder.

Maybe “copy a list of things” and then make changes to that list.

How do you mean? Iterating on the list?
You guys need a fully functional option to iterate. Something like a for or while loop in other languages. That’ll enable a huge amount of additional functionality and more complex apps.
(as I understand, your goal is to be a standard way to create web - iterating is a basic thing that no programming language can do without)

No, I mean workflow recursion on a list.

Not sure I understand enough computer science to successfully argue, but many languages have no concept of of iteration.

That isn’t to say we don’t need some way to do operations on lists. But I don’t see it can only be “do… Until” style.

Oh, yes. Recursion is a beautiful thing. It can do some of the stuff that the iterations do. But not all (in my experience)
Plus, recursion tends to be a lot slower than iteration.
In this case of list iteration recursion could do the job. (How can I efficiently do recursion in bubble?) But in some other cases I have had in mind it won’t cut it.