User bio
404 bio not found
Member since Aug 11, 2017
Replies:

got it to work, but there might be a better solution, if so, please comment

ClassMethod EditSurgery() As %Status
{
    S EditData={}.%FromJSON(%request.Content)
    w !,EditData.SurgeryCase,!
    #Dim otherProc As %DynamicObject
    s otherProc=EditData.OtherProcedures
    s iterator=otherProc.%GetIterator()
    while iterator.%GetNext(.key, .OtherProcedure) {
        set type = otherProc.%GetTypeOf(key)
        s name=otherProc.%Get(key).OtherProcedure
        s cpt=otherProc.%Get(key).PlannedOtherProcCPTCode
        s comment=otherProc.%Get(key).ProcedureCodeComments
        w !," name= ",name," cpt= ",cpt," comments= ",comment
    }

    q 200
}

OtherProcedures is a dynamic abstract object. I parse it out of the main JSON message. In the class definition for the JSON message:

Property OtherProcedures As list Of OtherProcedures;

Class REST.SwitchLane.Periopt.OtherProcedures Extends (%JSON.Adaptor, %Persistent)

{

Property OtherProcedure As %String;

Property PlannedOtherProcCPTCode As %String;

Property ProcedureCodeComments As %String;

}

Sorry, got pulled away before I finished the post to add my code. This code is a REST API. The pInput is the JSON message in the original post. this code does write out the key and type but I need to get the values for each procedure. Not sure how to get that data. 

ClassMethod fileSurgery1(pInput As REST.SwitchLane.Periopt.SurgeryData, Output pOutput As %String) As %Status

    #Dim obj As %DynamicAbstractObject

    s obj =pInput.OtherProcedures

    s iterator = obj.%GetIterator()

    while iterator.%GetNext(.key, .value)

    {

        set type = obj.%GetTypeOf(key)

        write !,"key= ",key,!,"Type= ",type

    }

    q 200

Certifications & Credly badges:
Phil has no Certifications & Credly badges yet.
Global Masters badges:
Followers:
Phil has no followers yet.
Following: