Array insert works weird

Hello,

I try to build array and I try to insert array elements on specific index, but problem is that I have 3 rows (inside loop) and this Insert method adds only first row, so my size of array is 1… but if I change Insert method to Add method everything works (I have size of array 3), but I would like to use Insert method, because I need to choose correct index for element. So why Insert method doesn’t add all rows into array?

Both Insert and Add will make the array grow by 1. Insert creates a new entry at the Index and pushes everything behind it by 1, Add creates a new entry at LastIndex + 1.

Perhaps you could use Set Array Elem instead; the specified index will be replaced with a new value. In addition, Set Array Elem has a tickbox which will expand the array in order to accommodate for the desired size, populating the missing indexes with default values.

I hope I understood you right.

2 Likes

Thank you :slight_smile: