Sidebar

When processing a ACK response how do I reference the source message?

0 votes
216 views
asked Jan 3, 2018 by daniel-d-7319 (180 points)

1 Answer

0 votes

The source.getNode() function can be used anywhere in the channel. Here is a couple of examples.

Acknowledgment Script:

message = qie.createHL7Message();
message.setNode('MSH-3', source.getNode('MSH-5'));
message.setNode('MSH-4', source.getNode('MSH-6'));
message.setNode('MSH-5', source.getNode('MSH-3'));
message.setNode('MSH-6', source.getNode('MSH-4'));
message.setNode('MSH-7', qie.formatDate('yyyyMMddhhmmss'));
message.setNode('MSH-8', source.getNode('MSH-8'));
message.setNode('MSH-9', 'ACK');
message.setNode('MSH-10', qie.formatDate('yyyyMMddhhmmssSSS'));
message.setNode('MSH-11', source.getNode('MSH-11'));
message.setNode('MSH-12', source.getNode('MSH-12'));
message.setNode('MSA-1', 'AA');
message.setNode('MSA-2', source.getNode('MSH-10'));
 

Ack Timeout script:

message = qie.postMessageResponse('timed out waiting for response to be posted: ' + source.getNode('MSH-10'));

Ack Script on Destination Node:

if (response === null || response.length === 0) {
   return false;
}
var ackMessage = qie.parseHL7String(response);
var sourceMsh10 = source.getNode('MSH-10');
var msgId = message.getNode('MSH-10');
var ackId = ackMessage.getNode('MSA-2');
if ((msgId.equals('') && ackId.equals('')) || !msgId.equals(ackId)) {
   qie.throwAckError("Ack id (" + ackId + ") not equal to message id (" + msgId + "): '" + response + "'");
}
return ackMessage.getNode('MSA-1').endsWith('A');

answered Jan 3, 2018 by brandon-w-8204 (30,600 points)
...