Let me explain. I have a simple screen. The screen looks like the following:

The button 'Create Collection" has the following code:
ClearCollect (
col_Test,
{
Title: "Title 1",
Index: 1,
Number: 0
},
{
Title: "Title 2",
Index: 2,
Number: 0
},
{
Title: "Title 3",
Index: 3,
Number: 0
}
)
The gallery Items property has the collection col_Test.
The 'Update If' button has the following code:
UpdateIf(
col_Test,
Index = 1,
{Number: Rand()}
);
UpdateIf(
col_Test,
Index = 2,
{Number: Rand()}
);
UpdateIf(
col_Test,
Index = 3,
{Number: Rand()}
)
Now this is the issue. I have clicked on the second item in the gallery:

Now if I click the 'Update If' button. The Number field in the items gets updated, but the gallery selected item becomes the first item without me clicking the first item as shown below:

I want the gallery's selected item to remain the second item and not change to the first item when I click 'Update If' button. Please help, I am desperate.