Forum Academy Marketplace Showcase Pricing Features

Managing order of items

Hello,

Could you tell me how I can manage items order while removing them from the list? Let’s imagine that I have table in the database called “Items”. This table has variables: ItemNumber, ItemTittle, ItemDescription.

On the page, I have a repeating group where all of these items are presenting. Also, there is the possibility to edit or remove each item. The problem is when I add, let’s say 6 items and then I will remove the second one then it will look like that.

ItemNumber: 1
ItemNumber: 3
ItemNumber: 4
ItemNumber: 5
ItemNumber: 6

What is the best idea to keep these items in order?
ItemNumber is setted automatically (while adding new item, I am checking the count of items and add + 1)

Thanks!

Hi there, @mateusz_krysztopowic… if I understand your post correctly, you would need to make changes to a list of things, and you need to make those changes before you remove the item in question because you need that item in order to define the list of things to change.

To clarify, in your example, the list of things to change is any item with an item number greater than the number of the item that is being removed (in this case, 2), and the change to make to those things is to subtract 1 from their item numbers. Once you’ve done that, you remove the item in question, and you’re done.

Anyway, I hope that makes sense, and I hope it helps, even if it’s just food for thought.

Best…
Mike

1 Like

Thanks for the response.

Could you tell me how I can make a loop to change all of the items that are below or above deleted item?

Thanks!

Did you try using the Make changes to a list of things… workflow action?

1 Like

and then as the list of things select: "repeating groups list of things:filtered order number greater than order number of current cell (the thing you are deleting)

and for that list decrement order number by 1

1 Like

Thanks! :wink:

1 Like