incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cunningham, Carl" <Carl.Cunning...@fiebig-team.de>
Subject Accessing individual records returned by a view
Date Sun, 01 Nov 2009 08:31:58 GMT
Hi folks,

I'm experimenting with using CouchDB as a datastore for various
MS-Office macros, and everything has been just wonderful until I started
to return result sets using views. It appears that the various JSON
implememtations for VBA (and there aren't many out there for pure VBA
code) don't seem to be able to deal with nested structures. Here's an
example:

A view returns the following JSON string:

{"total_rows":36778,"offset":26220,"rows":[
{"id":"6b80c0b76","key":"a@bbb.net","value":{"entryid":"81151F241C2500",
"subject":"test subject","senton":"2009-7-09 22:03:43"}},
{"id":"b10ed9bee","key":"b@bbb.net","value":{"entryid":A7C3CF74EA95C9F",
"subject":"test subject2","senton":"2009-4-21 10:18:26"}}]}

I then instantiate a jsonlib object, which contains the methods needed
to parse the string:
"Dim lib As New jsonlib"

Then I define a new object, which will eventually contain a
collection/dictionary object populated with the keys/values of the JSON
string:
"Dim json As Object"

Then the JSON string is parsed and shoved into the collection/dictionary
object:
"Set json = lib.parse(mystring)"


The problem here is that I can then only access the "total_rows" and the
"offset" keys/values; the "rows" value is blank.

I know that this is actually not a CouchDB question it's a VBA/JSON
question. I would very much appreciate any assistance.

Carl K. Cunningham

Mime
View raw message