Here's what we've done:

1. BS presents HL7 DFT w/multiple FT1s

2. BP routes this HL7 through a DTL that loops through each FT1,  and writes a single custom Record Mapper 'dummy' segment (which contains patient values and charge details in a single record) for a single file (which can accumulate 1 message, then close...although can also accumulate daily files, if your charge process permits).

3. BO outputs files created in step 2.

3. Record Mapper BS reads this file in, loops through each record, sending to a BP, which

4. passes this single charge through a DTL that creates an HL7 DFT for each record from the input file, sending to the final stage of

5. BO (sending 1 HL7 DFT per FT1 in original message)

So, for this approach you need: 

1.BS (HL7 tcp/ip)

2. BP (w/ HL7->RecMap DTL)

3. BO (RecMap file adapter)

4. BS (RecMap file adapter)

5. BP (w/ RecMap-> DTL) 

6. BO (HL7 tcp/ip)

Which is a little more work that a BPL, unless you're already experienced with both HL7 and Record Mapper, in which case you can create these and get them all working together in half a day.  We took this approach as an 'How To' for folks not yet up to speed on BPL.

If you want the repeat value within RXE:7, try this ->

foreach         source.{ORCgrp(1).RXE(1):ProvidersAdministrationInstr()}       p1

set                 tData = source.{ORCgrp(1).RXE(1):ProvidersAdministrationInstr(p1)}

code              write "Hi!!!_["_p1_"]..["_tData_"].!"

Reveals:

Hi!!!_[1]..[Start infusion at 0.2 mcg/kg/hr. Titrate up or down by 0.1 mcg/kg/hr every 20 minutes to RASS score 0 to -1. DO NOT BOLUS.].!

Hi!!!_[2]..[If RASS at goal on same infusion rate for greater than 8 hours, titrate down by 0.2 mcg/kg/hr every 20 minutes while keeping the RASS in desired range to minimize accumulation. Hold for HR < 70 beats/min. When HR increases by 10 bpm from when it was held, restart infusion at � the prior rate. ].!

Hi!!!_[3]..[Maximum recommended dose is 1.5 mcg/kg/hr. Notify provider if maximum ordered infusion rate reached.].!

(CRs added for formatting)

Examples of calling a function from csession, and setting DocType ad hoc:

ENSEMBLE>do ##class(UMMS.UMMC.HL7.ALL.RouterRoutines).SetDocTypeId( "40382754","2.3:ORM_O01")
/// note: quotes around the msgId don't seem to be necessary. Cache casts num to string?
/// Also, the shorter version of above is:
/// ENSEMBLE>set oref=##class(EnsLib.HL7.Message).%OpenId(40382754)
/// ENSEMBLE>s oref.DocType = "2.3:ORM_O01"  
/// ENSEMBLE>w oref.DocType
/// 2.3:ORM_O01
/// ENSEMBLE>do oref.%Save()Examples of calling ad hoc:

...where msgId is the first number listed in the Message Viewer Contents panel.

Class UMMS.UMMC.HL7.ALL.RouterRoutines Extends Ens.Rule.FunctionSet
{

ClassMethod SetDocTypeId(pMessageId As %String, pDocType As %String) As %String
{
    set $ZTRAP="SetDocTypeIdError"
    set oref=##class(EnsLib.HL7.Message).%OpenId(pMessageId)
    if '$IsObject(oref) {
        &js<document.all.display.innerHTML='Unable to open HL7 message';>
        quit
    }
    s oldDT = oref.DocType
    s oref.DocType = pDocType
    // the next call doesn't seem to be necessary unless we are running from the terminal
    // (at least as long as the production isn't bounced!)
    do oref.%Save()
    
    // only see in router's log if trace is enabled 
    $$$TRACE("ROUTER TESTING:: Was able to set old oref.DocType ["_oldDT_"] to new ["_oref.DocType_"] from passed in ["_pDocType_"] for msgID ["_pMessageId_"] ...\n")
    
    Quit 1

SetDocTypeIdError
    set $ZTRAP=""
    If $ZE $$$LOGERROR("$ZE: "_$ZE) //test unnecessary but ...
    $$$TRACE( "error setting ID doctype ["_pDocType_"] for ID ["_pMessageId_"] ... \n\n" )
    quit ""
}

}