Question
· Dec 3

Filename capture during BPL process

Need to capture filename during BPL process, then set it to MSH-6 in the HL7 message.

Please advice, if this can be done.

Product version: HealthShare 2023.1
Discussion (4)4
Log in or sign up to continue

Yes, filename capture during a Business Process (BPL) process and setting it to MSH-6 in an HL7 message can be performed as described below:

  1. Access the Original Filename: To access the original filename in BPL, you can use the property request.OriginalFilename if the message contains the Ens.StreamContainer object, which holds metadata like the original filename [1].

  2. Modify the HL7 Message: Using a DTL transformation within the BPL, you can set the value of MSH-6 in the HL7 message to the retrieved filename:

    • Create a Data Transformation (DTL) that modifies the HL7 message.
    • Use the context variable or the filename in the source (e.g., context.Filename) and assign it to the corresponding field target.{MSH:6} in the target HL7 structure [2][3].
  3. Sequence of Actions:

    • Retrieve the filename from the incoming data and store it in a context variable within the BPL.
    • Pass the HL7 message and the context variable to the DTL.
    • The DTL should include logic to map the context variable (e.g., context.Filename) to target.{MSH:6}.

This approach ensures the filename is correctly embedded in the MSH-6 segment of the HL7 message [1][3].

If further customization or examples are required, please share more details.

Sources:

I guess that you are using a Enslib.HL7.Service that uses EnsLib.File.InboundAdapter as Adapter. The problem is that the name of the file is not a property of Enslib.HL7.Message class, so you have to follow these steps:

  1. Create your own service that extends to Enslib.HL7.Service.
  2. Overwritte OnProcessInput process to get the name of the readed stream:
    Set tFileName=pInput.Attributes("Filename")
    set sessionID = $$$JobSessionId
    set ^GlobalName("Session", sessionID) = tFileName
    do ##super()
  3. From DTL use code to get the global that you created before getting the ID session from Enslib.HL7.Message and assign it to MSH property:
  4. Set globalValue = $GET(^GlobalName("Session", sessionID))
    
  5. And finally assign globalValue variable to the MSH propery (using SET from the DTL):
    target.{MSH.PropertyName} = globalValue