Replies:

Thanks Marc, unfortunately we are using an older version of Healthshare (2017) and the %Get method doesnt include the type parameter and only has the key. The method listed in the system is as follows:

Method %Get(key) As %CacheString
{
    
    try {
set ans = $zu(210,10, .key)
    catch do $$$APPERROR1($$$LASTERROR) }
    ans
}

Are there any other methods that can be used?

Thanks!

Hi Julius,

I may have posed my question incorrectly but if I leave the HL7 part out, the issue I have is for the repeated array objects like NOKName . An example of pData is as follows:

[
  {
    "patient":
      {
        "guid":"12345",
        "id":12345,
        "forename":"Joe",
        "surname":"Bloggs",
        "dateOfBirth":"2002-12-10T00:00:00Z",
        "NOK":[
                {
                   "NOKname":"Alison Bloggs",
                   "NOKrelationship":"Wife",
                   "telephone":"02081234567",
                   "email":"alison@bloggs.com"
                }
                {
                   "NOKname":"Peter Bloggs",
                   "NOKrelationship":"Father",
                   "telephone":"02081234567",
                   "email":"Peter@bloggs.com"
                }
              ]
      }
  }
]

The code I have used is:

Method GetDataFromStream(pData As %Stream)
{

    set object={}.%FromJSON(pData)
    set size1=object.%Size()
    set i=0
    for i=0:1:size1-1
    {
        
        set MyGuid=object.%Get(i).patient.guid
        set Myid=object.%Get(i).patient.id
        set MyForename=object.%Get(i).patient.forename
        set MySurname=object.%Get(i).patient.surname
        set MyDOB=object.%Get(i).patient.dateOfBirth
    
        set j=0
        set NOK = object.%Get(i).NOK
        for j=0:1:ref.NOK.%Size()-1  
        {
            set MyNOKname=NOK.%Get(j).NOKname
        }
    }
}

The problem is the variable "MyNOKName" only stores last value i.e. "Peter Bloggs". I would like to be able to store every instance of the "NOKName"  in a seperate variable based on the index(j) and use all of them at a later stage in the method. For instance MyNOKName(1) = "Alison Bloggs", MyNOKName(2)="Peter Bloggs"

Are you able to let me know if there is a way to do that?

Followers:
Pavithra has no followers yet.
Following:
Pavithra has not followed anybody yet.
Global Masters badges:
Pavithra has no Global Masters badges yet.