New command, Value type:

$type:=Value type($col[0])

And note if you use the new For each loop in version 17, all collection 
elements must have the same type.

John DeSoi, Ph.D.


> On Apr 26, 2018, at 10:36 AM, Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> If I'm iterating through a collection how can I get the type of an element?
> Here are some results from current attempts:
> $col:=New collection(New object;123;"XYZ";New collection)
> $type:=Type($col)  //  type = 42
> $type:=Type($col[0])  // err: 4D was expecting a field or variable or
> parameter
> $type:=Type($col[1])  // err: 4D was expecting a field or variable or
> parameter
> C_OBJECT($obj)
> $obj:=$col[0]
> $type:=Type($obj)  //  38
> $obj:=$col[1]
> $type:=Type($obj)  //  err: argument types are incompatible

**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to