Announcement

Collapse

Mirth Connect 4.1.0 Released!

Mirth Connect 4.1.0 is now available as an appliance update and on our GitHub page. Mirth Connect 4.1.0 includes new features such as new event log messages, additional fields to the Welcome to Mirth Connect screen, new information included in alerts as well as many smaller changes, updates, and improvements. This release also contains several improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Mapper/Transformer error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mapper/Transformer error

    I'm trying to convert an HL7 file to base64 using a mapper:

    FileUtil.encode(messageObject.getRawData());

    It generates an error:

    RROR-300: Transformer error
    ERROR MESSAGE: Error evaluating transformer
    com.webreach.mirth.server.MirthJavascriptTransform erException:
    CHANNEL: ChannelName01
    CONNECTOR: Destination 1
    SCRIPT SOURCE:
    LINE NUMBER: 105
    DETAILS: Can't find method com.webreach.mirth.server.util.FileUtil.encode(jav a.lang.String).

    Can anyone offer some insight? Thanks!

  • #2
    Re:Mapper/Transformer error

    Yes - the raw data is a string, but FileUtil can only encode Byte arrays. Do this:

    Code:
    var base64Data = FileUtil.encode(messageObject.getRawData().getBytes());
    That should give you what you're looking for...
    Chris Lang

    Comment


    • #3
      Re:Mapper/Transformer error

      Here is the API:

      Code:
      // Base64 decodes a string of data
      byte[] decode(String data)
      
      // Base64 encodes binary data
      String encode(byte[] data) 
      
      // Writes binary data to a file 
      void write(String fileName, boolean append, byte[] bytes)
      
      // Writes string data to a file
      void write(String fileName, boolean append, String data)
      
      // Returns the contents of the file in a byte array.
      byte[] readBytes(String filename)
      
      // Returns the contents of the file in a String.
      String read(String filename)
      Chris Lang

      Comment

      Working...
      X