1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
371 views
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. qie.parseHL7String('value 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.

 

 

by brandon-w-8204 (34.1k points)
edited by brandon-w-8204
...