Article
· Jul 27, 2016 2m read

"dynamic" headers and trailers for ensemble record maps

Hello,

This example shows an "HL7 to Batch File" example where the header contains "dynamic" information; in this case the total number of rows in the batch file is included in the header (using the same technique we could place this info in the trailer as well).  To accomplish this you simply (1) subclass the batch class and use COS to provide the logic for the dynamic fields in the header and trailer and then (2) configure the "DelayDefaultBatchOutput" setting on the batch operation to "TRUE" so that the batch header will not be written out to a temp file before all the records contained within the batch are available to the operation.

With that, attached is a code export of a sample production (and related files) that takes in a file with several HL7 messages and then writes some of the data contained in each message out as a batch file with a header and trailer.

To run the example, set the rollover time on the batch to whatever the “next minute” is, then run some HL7 messages into the HL7 file service and when it is “next minute o’clhl7tobatch.zip ock” you will see fields from the HL7 messages output to a file with a header and trailer as below:

Here is the text for the header. Number of Records: 8
54321|Test Patient|169 MY ST||CITYGOESHERE|MI|12345
12345|Test Patient|169 MY ST||CITYGOESHERE|MI|12345
54321|Test Patient|169 MY ST||CITYGOESHERE|MI|12345
23456|Test Patient|169 MY ST||CITYGOESHERE|MI|12345
34567|Test Patient|169 MY ST||CITYGOESHERE|MI|12345
45676|Test Patient|169 MY ST||CITYGOESHERE|MI|12345
|Test Patient|169 MY ST||CITYGOESHERE|MI|12345
|Test Patient|169 MY ST||CITYGOESHERE|MI|12345
Here is the text for the trailer.

Discussion (0)1
Log in or sign up to continue