Likewise
        $foo := $attributes{"cid"}{1}   // not on array or collection
works according to collection documentation on accessing an item with {1} even if not an array
but
        $foo := $row{"cid"}{1} // not on array or collection
 errors out with

$foo := $row{"cid"}{1}
Expected an array or collection handle.

Hmmm...I can't reproduce that with a valid RowSet and $row. $row is a collection like $attributes. This code worked correctly in the demo database:
global($ids; $names; $phones)
all records([vendors])
selection to array([vendors]name; $names; [vendors]phone; $phones)
$map := """
name: $names;
phone:$phones"""
$rs := RowSet.newFromArrays("name:$names;phone:$phones")
$row := $rs->getRow
$rs->last
writebr($row{"name"})
writebr($row{"name"}{1})

Are you sure you are not clobbering $row between the call to getRow and a4d.web.embedCollectionItems?

No I didn't clobber it, but I think I figured it out. - it does not like numbers.

The difference between

        $foo := $attributes{"cid"}{1} // $attributes is always text

and
$foo := $row{"cid"}{1} // in this case cid is a long integer and will generate an error

$a := 391
$b := new collection
$b{"a"} := $a
write($b{"a"}{1})

Will generate an error. It's either an interpreter error, or you can't reference numbers with {1}.

Steve Alex






_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to