Sidebar

How do I generate multiple HL7 messages, written to separate files, from one text-based message?

0 votes
185 views
asked Aug 21, 2023 by nathan-b-7857 (330 points)
The imagined flow is:

1) receive 1 text-based message to channel
2) run a select all db query in mapper
3) parse queryResult for values, building HL7 message
4) send HL7 message to destination, writing to a file

Not sure how to send each HL7 message to destination for writing once it is done being built.

1 Answer

+1 vote
 
Best answer

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.

 

 

answered Aug 21, 2023 by brandon-w-8204 (33,270 points)
selected Aug 21, 2023 by nathan-b-7857
...