Hi Joas,
Thank you for replying! I indeed want to use databaseManager.getDataSetByQuery, and now I manage to retrieve a single key/value pair quite nicely - e.g. "Intake" for "encounterName" in the below example. var value1 = jsObject['encounterName'] does the trick.
Unfortunately, what I need to have coughed up appears to be a few levels deeper, namely for every jsObject like this I need to have the "value" value if "key" equals to "DeliveryCaregivers.Gynaecologist". See the below example: this should give me "1012".
- Code: Select all
{
"actions":[
{
"class":"com.bma.common.dto.ActionDto",
"entries":[
{
"class":"com.bma.common.dto.EntryDto",
"id":null,
"key":"DeliveryCaregivers.Gynaecologist",
"performance":{ },
"type":"Observation",
"value":"1012"
}
],
"entryGroups":[ ],
"id":null,
"name":"DeliveryCaregivers",
"performance":{ },
"subject":{ },
"type":"CareAction",
"uuid":{ }
}
],
"class":"com.bma.emr.dto.EncounterDto",
"dirty":true,
"encounterName":"Intake",
"numberOfChildren":3,
"performance":{ },
"type":"Encounter"
}
Ideally, I'd write something like
- Code: Select all
var query = "Select data.actions.entries.value ";
query += "From myTable ";
query += "Where data.actions.entries.key = 'DeliveryCaregivers.Gynaecologist'";
(the column name is "data"): in this way I'd have everything immediately incorporated in the sql string and that would save me a lot of time.
But I suppose something like this is not possible in Servoy (or is it actually?). However, where jsObject['encounterName'] works well, jsObject["actions"["entries"["key"]] returns undefined - jsObject["actions"["class""]] already returns undefined. jsObject["actions"] returns [[object Object]].
Do you have a suggestion on how I can retrieve what I want?
Thanks once again!