Here is some sample code on how to do this:
//2) run a select all db query in mapper
var results = qie.doQuery('dbName', 'select records from someTable');
//3) parse queryResult for values, building HL7 message
for (var i = 1; i <= results.getRowCount(); i++) {
var someField = results.getNode('somefield', i);
// Build hl7 from data in query. This would need to be completed.
var hl7Message = qie.createHL7Message();
hl7Message.setNode('/', 'hl7content from your query');
//4) send HL7 message to destination, writing to a file. The spawnNew message will spawn a new message that will start processing on the next node in the visual channel editor
qie.spawnNewMessage(hl7Message)
}
//Discard teh original text message since the data is all processed in the for loop.
message.discard();
This would need to be expanded on based on your tables and queries. We are happy to assist just contact support.