UpdateHL7DTComponents()

Top  Previous  Next

Object: EHL7.HL7Vendors

FileName: EHL7.dll

 

METHOD

 

Name: UpdateHL7DTComponents()

Parameters: strXML (String) an XML string containing the information about the HL7 Datatype and its components to be updated in the current vendors HL7 definition.

Returns: Boolean

Description: Returns True if the datatype components were successfully updated.

 

*NOTE* Development license required to call this method successfully

 

Programming Note: When a new datatype is added, it is automatically assumed to have 1 component. 

 

Example XML String:

 

<COMPONENTS COUNT="2" HL7TYPE="TST" BASETYPE="Definition Editing demo" MAXCOMPONENTS="2"

INSTRUCTIONS="Can supply up to 512 bytes of instructions for each data type.">

<ITEM COMPONENT="1" ITEMGUID="22F9D571F73AF44E83A6C2168A5ED622" HL7TYPE="TST" COMPONENTTYPE="ST" DESCRIPTION="Alpha Value" />

<ITEM COMPONENT="2" ITEMGUID="9A56A6513D28A24B9B80AE3196D51DD6" HL7TYPE="TST" COMPONENTTYPE="NM" DESCRIPTION="Numeric Value" />

</COMPONENTS>

 

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

The HL7TYPE (root node) attribute is the name of the new HL7 datatype.
The BASETYPE (root node) attribute is an optional short description of the category of the data type (up to 50 characters)
The MAXCOMPONENTS (root node) attribute is the number of components that the datatype can have (same as COUNT)
The INSTRUCTIONS (root node) attribute is an optional text string containing up to 512 characters of instructions
The COMPONENT attribute is the sequential number of the component within the datatype (1-MAXCOMPONENTS)
The HL7TYPE attribute is the parent HL7 datatype of the component
The COMPONENTTYPE attribute is the HL7 datatype for that specific component
The DESCRIPTION attribute is a short text description of the the datatype component(max 100 characters)
The ITEMGUID attribute is the GUID assigned to be assigned to the component by EasyHL7

 

Programming note: This method will update the BASETYPE and INSTRUCTIONS on the parent datatype as well as updating the datatype components

 

See Also: HL7DataTypesXML(), AddHL7DataType(), HL7ComponentsXML(), QSXML Object

 

 

Example:

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

Dim strComponentID As String

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 = "<DATATYPE></DATATYPE>"

With myXMLObj

  .OpenFromString strXML

  Set domNode = .GetRootElement()

  .SetAttribute domNode, "HL7TYPE", "TST"

  .SetAttribute domNode, "DESCRIPTION", "Test HL7 data type"

  .SetAttribute domNode, "BASETYPE", "Demo Type"

  .SetAttribute domNode, "INSTRUCTIONS", "Whatever you care for them to be"

  .SetAttribute domNode, "ITEMGUID", CreateGUID()

  strXML = .XML

End With

With myVendorObj

   If Not .AddHL7DataType(strXML) Then

      MsgBox .LastError

      Exit Sub

   End If

   'Now the datatype has been added BUT by default it is added with 1 component of type

   'ST

   strXML = myVendorObj.HL7ComponentsXML("TST")

End With

With myXMLObj

       .OpenFromString strXML

      Set domNode = .GetNodeFromAttribute(.GetRootChildren(),"COMPONENT","1")

       strComponentID = .GetAttribute(domNode,"ITEMGUID")

      If Not myVendorObj.DeleteDataTypeComponent(strComponentID) Then

              MsgBox .LastError

             Exit Sub

      End If

      'Now we're going to add two new components to this datatype

       strXML = myVendorObj.HL7ComponentsXML("TST")

      .OpenFromString strXML

      Set domNode = .GetRootElement()

      .SetAttribute domNode, "COUNT","2"

      .SetAttribute domNode, "MAXCOMPONENTS","2"

       strXML = "<ITEM></ITEM>"

      'Add the 1st component to the xml

      Set chldNode = .XMLAddNode(domNode,strXML)

      .SetAttribute chldNode,"COMPONENT","1"

      .SetAttribute chldNode,"ITEMGUID",CreateGUID()

      .SetAttribute chldNode,"HL7TYPE","TST"

      .SetAttribute chldNode,"COMPONENTTYPE","ST"

       .SetAttribute chldNode,"DESCRIPTION","Alpha Value"

      'Add the 2nd component to the xml

      Set chldNode = .XMLAddNode(domNode,strXML)

      .SetAttribute chldNode,"COMPONENT","2"

      .SetAttribute chldNode,"ITEMGUID",CreateGUID()

      .SetAttribute chldNode,"HL7TYPE","TST"

      .SetAttribute chldNode,"COMPONENTTYPE","NM"

       .SetAttribute chldNode,"DESCRIPTION","Numeric Value"

       'Now the XML is formed

      strXML = .XML

End With

'Now call the update method

If Not myVendorObj.UpdateHL7DTComponents(strXML) Then

       MsgBox .LastError

       Exit Sub

Else

      MsgBox "Successfully added datatype TST with 2 components"

End If

End Sub