Add A Row Number Column To A Collection

Input collection: myBoardGames5

Game
Monopoly
Clue
Scrabble
Backgammon
Chess


Output collection: mySolution5

RowNumberGame
1Monopoly
2Clue
3Scrabble
4Backgammon
5Chess


Solution code:

//Create a collection
ClearCollect(myBoardGames5,
{Game: "Monopoly"},
{Game: "Clue"},
{Game: "Scrabble"},
{Game: "Backgammon"},
{Game: "Chess"}
);

// Row number code
Ungroup(
    ForAll(
        Sequence(CountRows(myBoardGames5)),
        {
            myRecord: Table(Last(FirstN(myBoardGames5,Value))),
            RowNumber: Value
        }
    ),
    "myRecord"
)