UpdateHL7Table() |
Top Previous Next |
Object: EHL7.HL7Vendors FileName: EHL7.dll
METHOD
Name: UpdateHL7Table() Parameters: 1) strXML (String) An XML string containing update information for the table you wish to modify in the selected vendor's HL7 definition. Returns: Boolean Description: Returns True if the table is successfully added to the vendor definition and false on failure. On failure check the LastError property for the error description.
Example XML: <UPDATE COUNT="2"> <ITEM TABLEID="2222" CODE="A" VALUE="Value A" ITEMGUID="96342010F06E674E82A2F415F8C61A91" DELETE="False" /> <ITEM TABLEID="2222" CODE="B" VALUE="Value B" ITEMGUID="96342010F06E674E82A2F415F8C61A91" DELETE="False" /> </UPDATE>
*Note: XML node and attribute names are case sensitive and should be uppercase:
*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: GetHL7Table(), HL7TablesXML(), 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 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 With myXMLObj strXML = "<TABLE></TABLE>" .OpenFromString strXML Set domNode = .GetRootElement() .SetAttribute domNode, "TABLEID", "2222" .SetAttribute domNode, "TABLENAME", "My Test Table" .SetAttribute domNode, "ITEMGUID", CreateGUID() 'The order of the attributes is not important .SetAttribute domNode, "SYSUSER", "User" strXML = .XML End With If Not myVendorObj.AddHL7Table(strXML) Then MsgBox myVendorObj.LastError Exit Sub End If 'Now we have created an empty table let's add 2 elements With myXMLObj strXML = "<UPDATE></UPDATE>" .OpenFromString strXML Set domNode = .GetRootElement() .SetAttribute domNode, "COUNT", "2" 'reuse strXML variable strXML = "<ITEM></ITEM>" Set chldNode = .XMLAddNode(domNode,strXML) .SetAttribute chldNode,"TABLEID","2222" .SetAttribute chldNode,"HL7CODE","A" .SetAttribute chldNode,"CODEDESCRIPTION","Value A" .SetAttribute chldNode,"ITEMGUID",CreateGUID() .SetAttribute chldNode,"DELETE","False" Set chldNode = .XMLAddNode(domNode,strXML) .SetAttribute chldNode,"TABLEID","2222" .SetAttribute chldNode,"HL7CODE","B" .SetAttribute chldNode,"CODEDESCRIPTION","Value B" .SetAttribute chldNode,"ITEMGUID",CreateGUID() .SetAttribute chldNode,"DELETE","False" 'XML is formed strXML = .XML End With With myVendorObj If Not .UpdateHL7Table(strXML) Then MsgBox .LastError Exit Sub End If MsgBox "Table 2222 added with 2 new elements" End With End Sub
|