Re: How do I get the type of a Collection element? (v16r6)

2018-04-26 Thread Julio Carneiro via 4D_Tech
The problem comes up when you’re working with Entity selections, where your time fields are converted to longints. Then Type or Value type of an Entity instance value does not match the field type. There’s a problem with Arrays in a Collection. Type returns 0, longint, because 4D Array variable

Re: How do I get the type of a Collection element? (v16r6)

2018-04-26 Thread Kirk Brooks via 4D_Tech
Julio, Yeah, date and time are a 4D thing really. I never store time values as 'time' anyway - always string. Frequently the same for dates. On Thu, Apr 26, 2018 at 11:47 AM Julio Carneiro via 4D_Tech < 4d_tech@lists.4d.com> wrote: > You do have Value type, but neither work 100%. Both fail Time

Re: How do I get the type of a Collection element? (v16r6)

2018-04-26 Thread Kirk Brooks via 4D_Tech
Thanks John On Thu, Apr 26, 2018 at 8:42 AM John DeSoi via 4D_Tech <4d_tech@lists.4d.com> wrote: > 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. > > > >

Re: How do I get the type of a Collection element? (v16r6)

2018-04-26 Thread John DeSoi via 4D_Tech
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

How do I get the type of a Collection element? (v16r6)

2018-04-26 Thread Kirk Brooks via 4D_Tech
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

Re: Object get type no longer returns the Object Array type in v16r6

2018-04-26 Thread John DeSoi via 4D_Tech
Yes, I thought this was interesting. A useful change, but no compatibility setting for this - all previous code that used OB Get type will need to be updated for version 16R/17. OB Get type can now return Is Date for dates, but it has a compatibility setting where it can be controlled. Also

Object get type no longer returns the Object Array type in v16r6

2018-04-26 Thread Kirk Brooks via 4D_Tech
Object get type has been changed in 16r something. Probably when collections were introduced in r4 but I wasn’t paying attention. The change is it no longer returns the ‘Object Array’ type (39). Any value that begins with a [ is interpreted as ‘Is collection’ (42). Object arrays still work just