Push collection into collection row

I have a “parent” $Collection and in a for each loop trying to push a child $optioncol collection into a row.

//Using a counter to get current row

$Collection[$i-1].push($optioncol)

Bit confused as cannot get either option to work get an unknown member function error
Thanks
Paul

Try this

$Collection.push($optioncol)

or

$Collection[$i-1]:=$optioncol

but if you have

$Collection[$i-1]:=$optioncol // $optioncol have to be a collection
$Collection[$i-1].push($other_optioncol)

this would work.

Thanks for reply,

It seems $Collection[$i-1] is an object not a collection so cant use .push To add a element you have to use

OB SET($Collection[$i-1];"options";$optioncol)
$Collection[$i-1]:=new Object
$Collection[$i-1].options:=$optioncol

Got it. I didnt explain very well. I was trying to insert an extra child element.
Thanks