UpdateHL7Segments()

Top  Previous  Next

Object: EHL7.HL7Vendors

FileName: EHL7.dll

 

METHOD

 

Name: UpdateHL7Segments()

Parameters: 1) strXML (String) An XML string containing update information for the segment(s) you wish to modify in the selected vendor's HL7 definition.

Returns: Boolean

Description: Returns True if the updates were successfully applied to the vendor definition and false on failure.  On failure check the LastError property for the error description.  To delete a segment prepare the XML string and set the DELETE attribute to "True"

 

*NOTE* Development license required to call this method successfully

 

Example XML:

<UPDATE COUNT="1">

<ITEM NAME="ACC" DESCRIPTION="Accident segment" ITEMGUID="86BBFE8B-C66B-4C59-9162-B4E9390925B9" DELETE="False" />

</UPDATE>

 

*Note: XML node and attribute names are case sensitive and should be uppercase:

The NAME attribute is the name of the segment to be updated.
The DESCRIPTION attribute is the description of the segment
The ITEMGUID attribute is the GUID assigned to be assigned to the Segment item by EasyHL7. 
The DELETE attribute will either be "False" (add or update the item) or "False" to remove the item.

 

*Programming Note: When the updates are performed, code items are identified by the ITEMGUID not the code and value.  Duplicates can be created.

 

See Also: AddHL7Segment(), SegmentsXML property, QSXML Object

 

Example Code to do this:

Private Sub VendorTest()

Dim myVendorObj As New EHL7.HL7Vendors

Dim strVendorID As String

Dim strXML As String

Dim domNode As Object

Dim nodeList As Object

Dim chldNode As Object

Dim myXMLObj As New EHL7.qsXML

myVendorObj.VendorPath = "C:\EasyHL7"

'Process the XML        

strVendorID = myVendorObj.GetVendorID("Default","2.3")

If strVendorID = "" Then

    MsgBox myVendorObj.LastError

    Set myVendorObj = Nothing

    Exit Sub

End If

If Not MyVendorObj.OpenVendor(strVendorID) Then

    MsgBox myVendorObj.LastError

    Set myVendorObj = Nothing

    Exit Sub

End If

strXML = myVendorObj.SegmentsXML

With myXMLObj

    .OpenFromString strXML

    Set nodeList = .GetRootChildren()

    Set chldNode = .GetNodeFromAttribute(nodeList,"NAME","ACC")

    If chldNode Is Nothing Then

        MsgBox "Accident segment not found in this definition"

        Exit Sub

    End If

    strXML = chldNode.XML

    'Open the new XML string with just the selected segment XML

     .OpenFromString strXML

     Set domNode = .GetRootElement()

     'Modify the attributes I wish        

    .SetAttribute domNode, "DESCRIPTION", "Accident Information Segment"

    .SetAttribute domNode, "DELETE", "False"

'     .SetAttribute domNode, 'NAME', 'ACC'

'     If I create a new GUID, then EasyHL7 would Add a new segment

'     As if I had called AddHl7Segment()

'     .SetAttribute domNode, 'ITEMGUID', CreateGUID()

    strXML = .XML

End With

If Not myVendorObj.UpdateHL7Segments(strXML) Then

    MsgBox myVendorObj.LastError

    Exit Sub

End If

End Sub