As Michael said, use a function to return your desired var
Also, arrays in df are zero-based [0..x].Code:Function ... returns Controls_Data[]
You are using them as if one-based [1..x].
keep in mind that countarray/sizeofarray function will not return the real number of elements in your array.