Display next item from a repeating group on index, in a popup, when a button is clicked

I worked out how to do this, for anyone else finding this post with the same question.

First, when the popup is opened, the current list of prompts being displayed in the RG on index, is sent to the popup as a custom state list.

Then, the “next” button does this:

  1. Uses plugin 1 Thing Plugin Index Finder to get the index number of the currently displayed Prompt.
  2. Puts this number into another custom state called List Position.
  3. Increments this number by 1 and resaves in same CS List Position.
  4. Identifies the Prompt in the CS Current List of Prompts which has the item # that is the CS List Position, and saves this Prompt into another CS called Next Prompt.
  5. Finally, displays Next Prompt as the data source of the popup.
  6. Reset the List Position and Next Prompt CS.

At step 2, I have a condition which says to only increment the List Position if it is not already equal to the count of the Current List of Prompt (ie. You’re viewing the last prompt in the list), and if it is equal to it then set it to 1 (ie cycles you back ti the first Prompt in the list).

For the button to cycle backwards through the list, the process is the same but the List Position is decreased by 1,except for when you’re already at item 1,in which case it’s set to the list count (taking you to the last item instead).