Announcement

Collapse
No announcement yet.

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