Read up about JSON (JavaScript Object Notation).  At least JSON is
compatible with Java, JavaScript, PHP, Python, and Ruby to name a few, see
http://json.org.  Your field names can be dictionaries or meta names.
Most other languages besides Unidata or Universe are not happy with dots in
the named fields so you need to replace them with some other character like
a underline. You will have to write a parser in UniBasic but you can do in
about 30 lines of code.  This syntax supports multi-values or even
sub-values.  Here are some simple examples:

Here is a single valued record:
 [{"IdCode":"A","Desc":"Active","ReportColor":"#CCFFFF","No_AR":""}]

Here is a multivalued record:
[{"IdCode":"178*MAINT","CustomerNo":"178,"G1EffectiveDate":[["10/01/2007"],[
"12/31/2010"]],"G1BillRate":[["0.00"],["1.00"]]}]"

JavaScript Reference would be for the first line if it was loaded as an
object called oData as:

Single array reference:
oData[0].IdCode would be "178*MAINT"

Multiple array reference:
oData[0].G1EffectiveDate[1][0] would be "12/31/2010"

We use this format in our U2WebLink middleware running under UniObjects for
Java for the Web.   The data is much more compact than XML and very
readable.  Most of the languages have the ability to parse this in a single
function.  In JavaScript it takes around 7 to 10 milliseconds to parse a
pretty big JSON string into a JSON array.

Regards,
Doug
www.u2logic.com/tools.html



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Rob Sobers
Sent: Thursday, December 09, 2010 4:05 PM
To: U2 Users List
Subject: Re: [U2] Sparse array population in Pick

What's the motivation for stuffing an XML-like data structure into a U2
database?  Is this just a thought experiment?

-Rob

On Thu, Dec 9, 2010 at 5:35 PM, David A. Green
<[email protected]>wrote:

> If you can restrict the tag names to valid dictionary names you could 
> do something like:
>
> TAGS DICT:
> 1052_MAKE
> 1052_MODEL
> 1052_AGE
>
> TAGS DATA:
> 001 Chrysler
> 002 LeBaron
> 003 7 years and 3 days
>
> David A. Green
> (480) 813-1725
> DAG Consulting
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of 
> [email protected]
> Sent: Thursday, December 09, 2010 3:10 PM
> To: [email protected]
> Subject: [U2] Sparse array population in Pick
>
> Years ago I had written a system, far predating XML, where the 
> element-tags were unpredictable.  Essentially the user was allowed to 
> create any tags they wished, and any number of tags they wished, attached
to another item.
>
> Each tag had an associated value.  So far example
>       Zip Code = 95062
>
> You could not however predict what tags a person would use, they were 
> all free-form and user-supplied, but you still had to store the tag 
> with their associated value.
>
> At the time I developed two ideas for how to do this in a Pick item
>
> TAGS1052
> 001 Make = Chrysler
> 002 Model = LeBaron
> 003 Age = 7 years and 3 days
>
> TAGS1052
> 001 Make]Model]Age
> 002 Chrysler
> 003 LeBaron
> 004 7 years and 3 days
>
> The first model is clear.  Anyone with no programming background at 
> all, can easily understand it, and also easily edit it.  It suffers 
> from requiring more elaborate programming than the second model, as 
> you have to parse every
>
> element.
>
> The second model is not quite as clear.  You determine the attibute 
> position of the "value" by locate the tag in attribute 1 and then 
> adding 1 to it.
> That gives you the attribute number where the value lives.  
> Alternately you could simply pre-fill attribute 1 with an initial null 
> to push everything forward 1 place, then you wouldn't have to add 1 after
your locate.
>
> Comments?  Critiques?  Nasty cat-calls and grimaces?
>
> Will Johnson
>
>
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to