Custom Code
This feature is a mini-programming environment for developing custom functions. Custom functions can be used to generate a CSV file of patient attributes matching some complex criteria, file data into a database, analyze complex message exchanges, or any task that isn't directly supported by HL7Spy.
Requirements
The Custom Code tool is not for the faint of heart. To use this tool you need some programming experience, particularly in .NET c# which is the language that is used within the tool.
Resources
- HL7Spy comes loaded with some sample functions.
- There are some samples of goal-oriented functions submitted by our users here: http://hl7spy.ca/hl7-code/.
- Documentation of the available classes in HL7Spy.Core can be found here: HL7Spy.Core.chm (Right-Click after downloading and "Unblock" to view)
Hello World!
When showing how to use a programming language/tool it is customary to print "Hello World!" since it is usually the simplest starting point. In HL7Spy we will set MSH-3 to "Hello World!" to keep with this tradition.
public override void Run() { // Get an HL7 Message in parsed format HL7Message message = GetParsedMessage(); // Set MSH-3 to "Hello World!" message["MSH-3"] = "Hello World"; // Same thing, but using a different syntax message.MSH.SendingApplication_03.NamespaceID_01.Value = "Hello World!"; // Save the altered message into a new tab SaveMessage(message,"Hello World Tab"); }
The result if you press the Run button is that a new Tab will be generated and every message will have a value of "Hello World!" in MSH-3.