I did work out a work/around by instead of using a recursive function, I use a for loop. Start index 0, and last index a variable. During the loop, I query if this is the last iteration, and if not, I add 1 to the variable, so that it keeps increasing by 1 until the query is met.