iNTERFACEWARE Products Manual > Installing and Using Chameleon > Language API Documentation > Visual Basic Support > Parsing a Message |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
The interface for parsing a message using any of the generation options is identical. But, before an Engine object can be used to parse a message, it's very important that the message definition file is loaded first.
A good place to do this is in the Form Load event of your Visual Basic program. Care should be taken to ensure that the location of the message definition file is not hard-coded into your application:
Once the message definition file is loaded, you're ready to start parsing messages. This is done through passing an HL7 message in a string object to the Parse function of the Engine object:
If the HL7 message can be successfully parsed, the Parse function will invoke a message event corresponding to the message type. If the parse fails, the OnParseError event will be fired instead. As a programmer, you must provide the event code for each message defined in the message definition file. This is an example:
Each of these message events has two parameters:
The message object is a generated class that has methods for retrieving the tables that compose each message. Each table object has methods to get and set the column values in the table. These classes are described in Generated Classes. The ResultMessage string is used to return an ACK message back to the code which invoked Engine.Parse. Whatever the event sets, the ResultMessage string will be returned as the result of the Engine.Parse function. |