Forum Academy Marketplace Showcase Pricing Features

Truncate a list / remove all items after a certain (current) position

Building a simple app that allows someone to build a list. You can move back and forth in the list.

What I want is that if someone enters something while they are not at the end of the list (in this case at ‘earth’), that the items after that are removed from the list and the new item (here ‘hawk’) is added.

Should I build some sort of condition that is called to do this? How? Or is there a better way?

In the datatype that holds the values displayed in the RG you should put a field that is of type number and label it something like ‘sort-order’. This will let you keep track of the number order of entries, and so you can move them to a different position.

Looks like from the screen shot you have it set up so the entry selected (earth in your screen shot) is in a group that contains that value. You could setup workflows to make changes to a list of things and that list of things is the same list as in the RG so the RG can be your datasource. Use the filter parameter to isolate only those entries whose field ‘sort-order’ is greater than the selected entry (in your example Earth).

The change you make will be to the ‘sort-order’ field and the change would be the things ‘sort-order’ value + 1 to move it one entry further in the list…then the thing you created would be created with a ‘sort-order’ value of the selected thing (Earth) ‘sort-order’ value + 1 to put that newly created thing directly after the selected thing in the list while also shifting every item below down by 1.

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