Creating multiple HL7 messages based on data contained in one inbound HL7 message

I'm looking for options to create multiple DFT HL7 messages based on data contained in a ZCO segment in a single inbound DFT message.  I have the following ZCO segment:

ZCO|CCC^Charge Code|1306794,1071301,23510,1071424|MFCD^Charge Code|14232,3542|||||

In this example, I need to create a new DFT message based on the data contained in ZCO:2.  Each code needs to be in it's own DFT message and put in FT1:7.1.  The number of codes will vary for each inbound message, but each code will need to create its own outbound message to the client.

  • 0
  • 0
  • 52
  • 3
  • 2


You can use split on ZC02, get the length, then for each number that it split you create a separate DFT message.


Thanks for the reply.  I could use more detail since we recently started using Health Connect.  I was doing that, splitting the ZCO, when the client was willing to accept each code in its own FT1 segment all contained in one DFT message, but the scope has changed.  Since I'm new, I'm unsure where this logic should be.  Do I create each message in the DTL and have a way to sending each message out, or follow another approach?

The conventional mechanism for generating multiple outbound messages from a single inbound is via a BPL. It can also be done in a custom BP using ObjectScript, and I've also seen it done using the rule editor (but wouldn't recommend it ... it's not exactly intuitive).

In a BPL, you'd assign a context variable to the list of values extracted from ZCO:2 (using $LISTFROMSTRING()), then iterate over the list with an <until> action. You'll also need to create some other context variables for list length, iteration and element selection.

Inside the <until> you would:

  1. Increment the iterator and obtain the current list value using <assign> actions
  2. Invoke a DTL with a <transform> action that copies the relevant fields/segments from the source message to the target
  3. In the same DTL, use the current list iteration value to populate FT1:7.1
  4. Send the resulting message to the downstream Business Operation with a <call> action

The answer above is significantly different from what I originally posted. the <foreach> action doesn't interpret a %List as a collection, so I went with an <until> instead. The condition for completion of the <until> is when the iterator equals the count of entries in the list (obtained by $LISTLENGTH()).