Things to know about using the oMSG object

Top  Previous  Next

Commando (and CommandoScript) was designed to work with HL7 data.  This was done using the EasyHL7 ActiveX Development Toolbox.  The EasyHL7 ActiveX toolbox is a simple to use, inexpensive suite of RAD software development tools designed primarily for the creation of client-server based software.  The Commando product uses a special runtime license which is valid only for the Commando Product which means that you don't have to purchase a separate license for the EasyHL7 Toolbox to use the Commando environment.

 

In order to access many of the methods directly from a VB Scripting language (such as CommandoScript) or ASP, ASP.NET etc you have to create your own ActiveX class wrapper.

 

The oMSG object is a 'class wrapper'.  What that means is that we've taken the main 2 EasyHL7 classes (the EHL7Message object and the HL7Vendors object) and 'wrapped' them up by creating a third object (the oMSG object) which can be used to access some of the commonly used properties and methods of both of these EasyHL7 objects.

 

For more information about EasyHL7 and the HermeTech International suite of HL7 tools please visit www.hermetechnz.com or contact info@hermetechnz.com.

 

 

The main difference between using the oMSG object and using EasyHL7 objects in VB or VB.Net:

 

The main difference between using functions in the oMSG object rather than calling the native EasyHL7 API functions is the calling convention and parameters.  Consider the EHL7Message object method GetFieldValue().

 

The GetFieldValue() Method in EasyHL7 takes 3 parameters:

1.oSegment (an OBJECT) which was the return value of the GetSegment() or AddSegment() methods
2.nFieldNumber (a Long)
3.nFieldComponent (an optional Long default = 1)

 

To call this method from within VB or VB.Net it would look something like this

 

Dim oSeg As Object

With myMsg  'Say myMsg is an EHL7Message object

    Set oSeg = .GetSegment("MSH")

    Msgbox "Message Type = " & .GetFieldValue(oSeg,9,1)

End With

 

In CommandoScript you can ONLY DIM variables as variants (you can't "DIM oSeg As Object" for instance).  And since GetFieldValue is explicitly expecting an Object (not a variant) in the first parameter, calling it directly from CommandoScript will generate an error.  The oMSG object passes the calls along for you, taking in the variant, and returning HANDLES (string GUIDs) which you then use to access the data like so:

 

<% 'In ASP It would look like this

Dim hSeg 'As a variant

With myMsg  'Say myMsg is an instantiated oMSG object

    'Note that no Set statement needed         

    hSeg = .GetSegment("MSH")

    SMEvent.Raise "TRACE", "Message Type = " & .GetFieldValue(hSeg,9,1)

End With

%>

 

Things to read: You should thoroughly review the EasyHL7 documentation for the EHL7Message object and the HL7Vendors object.  In this help file most of the properties and methods will refer you to their corresponding property/method in the EasyHL7 documentation.

 

EasyHL7 documentation http://www.hermetechnz.com/Documentation/EasyHL7/index.html.