Chris,
As in MV Basic code when you deal with associated multivalue sets each field is treated as a collection by itself. What you are seeing is the JSON representation of that. Each Multivalued field becomes an array structure within the JSON. Each field is separate from the others. Your code would need to enforce the association.
You can contrast this to using Cache default storage where the way to create an collection of associated elements of data would be to create a serial object that contains properties for each element of data in the association. Then in the parent class you create a “list of” those objects.
Hope this helps
Richard S Taylor
Sales Engineer
InterSystems Corporation
Office: 443-340-8614
FAX: 440-815-5805
--
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
To post to this group, send email to Cac...@googlegroups.com
To unsubscribe from this group, send email to
CacheMV-u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/CacheMV?hl=en
---
You received this message because you are subscribed to the Google Groups "InterSystems: MV Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
InterSystems-...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Chris,
To put the JSON into a variable you would use the Read() or Readline() method of the stream class. There is a caveat though. The maximum string for in Caché 3.6 mb. If your JSON is larger than this you will get an error. If this is an issue then you will either need to change your code to work directly with the stream or break the JSON into pieces. Why does this need to be in a variable?
To your question on dynamic class references when you try to open an object, in Caché Object Script there is a function for this; $Classmethod(). Unfortunately this is not available in MV Basic. Here is a way to get around this:
classname = "MVFILE.PERSON"
a = ";obj = ":quote(classname):"->%OpenId(2)"
Perform a
The Classname is assigned to a variable. The a command line execution of a MV Basic statement (note the ; at the start of the line) that opens an instance of that class. A PERFORM statement is then used to execute this within the context of the local variable environment. The variable Obj will now have the handle to the MVFILE.PERSON object.
Rich
At this time I am not sure of this. I can see if a request has already been put in and do some additional checking myself to see if there is an alternative that would work today. One thought is to use the JSON SQL provider to generated the JSON based on grandchild table queries. This provider is available in 2013.1.
Chris,
Just wanted to follow up with you to be sure you got all the answers you needed from the responses here. Let us know if you have any further questions.
From: InterSy...@googlegroups.com [mailto:InterSy...@googlegroups.com] On Behalf Of Chris B
Sent: Thursday, May 23, 2013 12:44 PM