Hi @JoaoSantos489,
Add this formula to OnSelect of both + and - buttons. This will (only once) create a temporary collection with a new column that will allow us to go to the next / previous row.
// Create new collection with only the key column from the gallery
If(
IsEmpty(colMyGallery),
ClearCollect(
colMyGallery,
ShowColumns(
galMyGallery.AllItems,
"ID"
)
)
);
// Create new collection based on first collection with one extra column that contains an auto increment number "MyID"
If(
IsEmpty(colMyNumberedGallery),
ForAll(
colMyGallery,
Collect(
colMyNumberedGallery,
Last(
FirstN(
AddColumns(
colMyGallery,
"MyID",
CountRows(colMyNumberedGallery) + 1
),
CountRows(colMyNumberedGallery) + 1
)
)
)
)
);
Now add this to + button
// Retrieve next item from gallery and store its ID in a variable
Set(
varSelectedItem,
LookUp(
colMyNumberedGallery,
LookUp(
colMyNumberedGallery,
ID = ThisItem.ID,
MyID + 1
) = MyID,
ID
)
);
And this to - button
// Retrieve previous item from gallery and store its ID in a variable
Set(
varSelectedItem,
LookUp(
colMyNumberedGallery,
LookUp(
colMyNumberedGallery,
ID = ThisItem.ID,
MyID - 1
) = MyID,
ID
)
);
Now varSelectedItem will have an ID value. You can use that to display the information you want.