Announcement

Collapse
No announcement yet.

Transformer doesn't work on destination but does on source

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

  • Transformer doesn't work on destination but does on source

    I have a javascript transformer that copies fields between segments. I have it on the source currently and it works fine.

    However, we're adding a new destination and I don't want to transform everything for that new channel, so I'm moving it from the source to the original destination.

    However, it does not work. It's the exact same code only on the destination transformer rather than the source transformer.

    Do I need to add something for a destination transformer to get it to work?

  • #2
    If you post your exported channel, it will be easier for others here to troubleshoot.
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


    - How do I foo?
    - You just bar.

    Comment


    • #3
      msg variable is different in source and destination

      I suspect that you are suffering from something that I too had to face recently.
      The msg variable is not the same in the source as it is in the destination, it has been transformed into an XML schema ( whether you wanted that or not ) and so any mappings to variables in transformer javascripts within the msg variable will fail in the destination transformer because the msg variable has changed.

      If I'm correct, then I will share my solution. Bear in mind that this may not be the 'Mirth Recommended' solution, but it worked for me, so here it is.

      In the last source transformer put:
      Code:
      var incomingmsg = msg;
      channelMap.put('incomingmsg',incomingmsg);
      In the first destination transformer put:
      Code:
      var msg = new XML(channelMap.get( 'incomingmsg' ).toString());
      After that you can put all of the original javascript transformers and they should work as you can now address the msg variable in the destination with the exact same syntax as in the source.

      I hope this helps!

      Comment

      Working...
      X