I am having an issue accessing a Dictionary that’s being created when I’m getting patient information from an EMR provider (Athena). I’m having no issues iterating through patient records when I search by patient name and DOB… I get a Dictionary nested within another Dictionary and I can work with this. HOWEVER, when I do a GET by Patient ID, it returns an Auto() nested within another Auto() which contains the Dictionary.
So, can anyone tell me how I access an Auto() value within another Auto()? I believe it’s essentially an array within another array, right?
Sub PageReceived(url as string, httpStatus as integer, headers as internetHeaders, content as string)
Dim buffer As Text = content.defineEncoding(Encodings.UTF8).convertEncoding(Encodings.UTF8).ToText
Dim cHeaders As InternetHeaders = headers 'This isn’t really necessary…just prevents warning when compiled
cHeaders = cHeaders 'This isn’t really necessary…just prevents warning when compiled
// Add brackets so JSON is well-formed and we parse to create a dictionary (“records”)
buffer = “[” + buffer +"]"
Dim records() As Auto = Xojo.Data.ParseJSON(buffer) 'Gets parsed JSON data in form of Dictionary or array of Dictionaries
Derk - thank you…I’m pretty sure this is what I’m doing but I’m getting an OutofBoundsException error. The problem is that the Dictionary is nested within another Auto() . Please see my attached image.
[quote=437565:@Aaron Schacht]Derk - thank you…I’m pretty sure this is what I’m doing but I’m getting an OutofBoundsException error. The problem is that the Dictionary is nested within another Auto() . Please see my attached image.
Thanks![/quote]
In your fist post you see:
Records | Auto(0)
That means there is 1 item of type auto in your records() As Auto array.
You should be checking if records().ubound <> -1
And also keep track of the ubound in loops.
I dont see where you get the OutOfBoundsException.
If the array has other arrays in it you should be selecting the right thing, that is probably:
Dim RecordsDicts() As Xojo.Core.Dictionary = records
Dim Record As Xojo.Core.Dictionary = RecrodsDict(0)