Nth of string inside the loop - how can I define?

Hi for everyone, I am new at the forum. I have a problem, I would like to make string manipulation inside the loop.
The problem: I can’t define the i-th of incident after var str.

Somehow like this (this is wrong because after var str I can’t define correctly the i-th incident)
I hope someone could help for me. Many thanks.

{
“Name”: “sport”,
“CreationDate”: “2021-8-23”,
“Commands”: [
{
“Command”: “storeTitle”,
“Target”: “”,
“Value”: “title”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “var str = ${title}; var res = str.split(”|");\nreturn res[0]",
“Value”: “title”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “var str = ${title}; var res = str.split(” “);\nreturn res[0]”,
“Value”: “hometeam”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “var str = ${title}; var res = str.split(” “);\nreturn res[2]”,
“Value”: “awayteam”,
“Description”: “”
},
{
“Command”: “sourceSearch”,
“Target”: “incident soccer”>",
“Value”: “nr_incidents”,
“Description”: “”
},
{
“Command”: “sourceSearch”,
“Target”: “icon ball”>

",
“Value”: “nr_goals”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “fast”,
“Value”: “!replayspeed”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “1”,
“Value”: “i”,
“Description”: “”
},
{
“Command”: “while_v2”,
“Target”: “${i} <= ${nr_incidents}”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “sourceExtract”,
“Target”: “incident soccer*]@${i}”,
“Value”: “incident${i}”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “var str = ${incident}${i}; var res = str.split(”’

");\nreturn res[0]",
“Value”: “incident${i}”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “return Number (${i}) + 1;”,
“Value”: “i”,
“Description”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “”,
“Description”: “”
}
]
}

What is the problem? Is it to increment the ${i} variable?

Hi, thanks for the reply:

This part of code:
var str = ${incident}${i};

I would like to use the value of “incident${i}” after var str , but I don’t know what is the correct format to define this.
I hope someone could help for me.