array looping function for dynamic layout

I have two CDTs. on the first screen the users select items from the grid and for every selected item I am making a dynamic section to capture details in the myItemDetail_cdt. to create the dynamic layout section I need to know the number of indexes in the array.

I was thinking    1 + enumerate(count(pv!items_cdt)), should give me the count so I know how many items got selected then using type!myItemDetail_cdt() should create a empty array index. what is the looping function to do this? I tried the apply and I have to pass a function.

apply(type!type!myItemDetail_cdt(), 1 + enumerate(count(pv!items_cdt))

 Discussion posts and replies are publicly visible