User bio
404 bio not found
Member since Nov 6, 2020
Replies:

Thanks Sean!  I was able to trouble shoot and came up with the below code that does add my ZM1 segment.

Method OnRequest(pRequest As EnsLib.HL7.Message, Output pResponse As Ens.Response) As %Status
{
#dim newrequest = pRequest.%ConstructClone()
#dim eException As %Exception.AbstractException
#dim tSC       As %Status =$$$OK

   SET FedExID = "123456"
    
    SET segcount = newrequest.SegCountGet()
    $$$LOGINFO("segcount "_segcount)
    
    SET newsegpos = segcount +1
    $$$LOGINFO("newsegpos "_newsegpos)
    
    SET zm1str = "ZM1|1|||||||||||||||||||" _FedExID
    #;SET zm1str = "ZM1|1|||||||||||||||||||" _FedExID _"|"
    
    SET zm1 = ##class(EnsLib.HL7.Segment).ImportFromString(zm1str,.sc,pRequest.Separators)
    $$$QuitOnError(sc)
    
SET newseg = newrequest.SetSegmentAt(zm1,newsegpos)
$$$QuitOnError(newseg)

SET pRequest = newrequest
#;SET tSC = ..SendRequestSync("HL7FileOperation", newrequest)
SET tSC = ..SendRequestSync(..TargetConfigName, newrequest)
#;return newrequest Quit tSC
}

Thanks for the response Julius.  I have used that before when the property came in the JSON consistently in the same format.  In this case it can come in as: 

"members": null,

or as:

"members": [
                {
                    "dob": "1905-05-01",
                    "firstName": "BOB",
                    "middleName": "T",
                    "nameSuffix": "",
                    "genderCode": "M",
                    "lastName": "COLLINS",
                    "memberId": "123421741",
                    "relationship": "Subscriber"
                }
            ],

Not sure this way will accommodate the two possible structures.

I am still getting "ERROR #9406: Unexpected format for value of field, members, using class base mapping".

Is there anything else that needs to be set along with the %DynamicArray?  I also tried %DynamicObject as well.

Property members As %DynamicArray; Property relationship As %String; Storage Default
{
<Data name="members">
<Attribute>members</Attribute>
<Structure>node</Structure>
<Subscript>"members"</Subscript>
</Data>

Certifications & Credly badges:
Rick has no Certifications & Credly badges yet.
Global Masters badges:
Rick has no Global Masters badges yet.
Followers:
Rick has no followers yet.
Following:
Rick has not followed anybody yet.