Standard QIE Functions¶
QIE includes several standard functions that can be used in the scripting environment to facilitate message processing. They are grouped into the categories below; each section describes what that category of functions is for.
The Code Wizard is the function reference
This page describes what each group of functions is for. The functions themselves, every signature, parameter, return value, and worked example, are published by the Code Wizard in the script editor, generated from the same definitions the engine uses, so they can never drift from the product. Open a script and use the Code Wizard menu, or Help -> Code Wizard Documentation for the searchable catalog.
Ack Script Functions¶
Ack scripts are used to determine if a message was sent correctly to the receiving system. They can provide information about errors in the message.
Binary Functions¶
Binary functions provide the ability to manage base64 and hexadecimal data. Base64 is a group of similar encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. Many registries and HIE's require data to be Base64 encoded.
Hexadecimal is a base-16 numbering system which uses 16 distinct symbols (usually 0-9 and A-F to represent values 0-15). The code wizard includes functions for encoding and decoding HEX data.
Certificate Functions¶
The QIE certificate functions make certificates and private keys available for use in mapping functions. This can be helpful in troubleshooting web service calls.
Channel Functions¶
Channel functions are used to start, stop and pause a channel or add an inbound message.
Channel Status Functions¶
Channel status functions are used to determine the status of a channel and retrieve message counts.
Database Functions¶
Database functions are used to execute database query and update statements. The Code Wizard includes query snippets to access data in MSSQL and Oracle databases.
Electronic Mail Functions¶
These functions are available to send or queue electronic mail messages. There are also functions to manage attachments.
Note
QIE must be configured with an outgoing email server (see Email Settings). The body is assumed to be HTML formatted text. To format the body as plain text only, add <pre> before the body and </pre> after the body.
To include attachments, build an attachment map with qie.newEmailAttachmentMap(), add one or more attachments to it, and pass the map as the last argument to qie.sendEmail (or qie.sendEmailWithCC, qie.queueEmail, qie.queueEmailWithCC):
var attachments = qie.newEmailAttachmentMap();
// Attach a file from disk (uses the file's own name)
qie.addEmailAttachmentWithFile(attachments, qie.newFile('C:/reports/daily.pdf'));
// Attach in-memory content under an explicit filename
qie.addEmailAttachment(attachments, 'message.hl7', message.toString());
qie.sendEmail('ops@example.com', 'Daily report', '<p>See attached.</p>', attachments);
Escape Functions¶
When data values are used as part of output messages or SQL statements, they may first need to be properly escaped. The escape functions facilitate escaping and un-escaping string values for different formats.
File Functions¶
If a message originated from a file, the file functions can be used to evaluate the file name, extension, etc. There are also file functions to read, move and delete files.
Note
The functions that report the originating file's name, path, and extension only apply to channels whose message source is a file. The read, write, move, and delete functions work regardless of the source.
Log Message Functions¶
Log message functions are used to add additional messages to the QIE log.
Message Response Functions¶
Channel source nodes can be configured to wait for a response to be posted by another channel node. The message response functions are used to post and cancel pending message responses.
Miscellaneous Functions¶
Deduce Boolean, Do table lookup and various other functions.
New Message Functions¶
New message functions are used to reset or change the format of the output message.
Parse String Functions¶
These functions parse a string value and return a QIE message object, which can then be used to set and retrieve node values. There is one per message format: HL7, XML, JSON, CSV, and the rest.
String Utility Functions¶
String utility functions are used to manipulate string values, evaluate templates, apply XSL transforms, etc.
System Variable Functions¶
System variable functions assist with table lookups and managing variables.
Regular Expression Functions¶
Regular expressions are used to search for a pattern in a string of data.
Web Service Functions¶
Web service functions are used to call web services using various protocols.
Importing Java Packages and Classes¶
Java packages and classes can be imported and accessed from within the QIE scripting environment, using the importPackage and importClass functions the Code Wizard provides under this category. See Creating Custom Scripts for how imported classes behave inside the Rhino engine.