David,

Peter Hay uses a nifty method of appending a type indicator onto the
property name.

So you instead of

OB SET ARRAY($MyObject_o; "My Array" ; $MyBooleanArray_ab)

OBW_SetArray ($MyObject_o; "My Array" ; ->$MyBooleanArray_ab)

Within OBW_SetArray you determine the type of the array and append _ab
to the proper name

When you use OBW_GetArray ($MyObject_o; "My Array") it looks for a
property name that matches "My Array" and then appends the the _ab
before retrieving it.

Another alternative would be something like this:

OB_SetText ($MyObject_o; "My Text"; "Hello World")

Internally you would save "My Text.Value" i.e.  "Hello World" and "My
Text.Type" i.e. Is text

For the array example above you could save:

"My Array.value", "My Array.type", "My Array.selected" (if you needed
to know the selected element.


Regards,

Wayne


Wayne Stewart
about.me/waynestewart




On 11 January 2017 at 17:13, David Adams <[email protected]> wrote:
> P.S. I just tried some snazzy magic trying to pre-coerce all arrays into
> object arrays and setting them like that. If you use OB Stringify array,
> you get a single quoted text block holding an 'array'. It looks like an
> array as JSON, but since it's quoted it's a text value. Trying coerce that
> into an object array with JSON PARSE ARRAY gets you garbage. I only tried
> with longint and Boolean arrays. The longint array converted to the right
> number of array elements, but with garbage. The Boolean converted to a
> single value rather than all of the elements. So, this is clearly now what
> the commands are intended for...The docs aren't that clear to me, it looked
> like they commands might be abel to turn anything into an 'object', but
> they don't.
>
> So, what about John's idea of storing type data in the object? I guess you
> would:
>
> * Wrap the OB SET/Get array calls.
>
> * Put each array into a nested object containing a simple type description
> value and whatever array you want.
>
> Is anyone doing this? I can see it. At least any object following these
> rules would be generically readable.
>
> Thanks for any thoughts.
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to