web stats
Transformer doesn't work on destination but does on source - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 04-26-2017, 12:26 PM
KrisL KrisL is offline
What's HL7?
Join Date: Apr 2017
Posts: 1
KrisL is on a distinguished road
Default 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?
Reply With Quote
Old 04-26-2017, 12:30 PM
narupley's Avatar
narupley narupley is offline
Mirth Employee
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road

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.
Reply With Quote
Old 04-27-2017, 07:41 PM
stormcel stormcel is offline
OBX.3 Kenobi
Join Date: Mar 2010
Location: Phoenix
Posts: 173
stormcel is on a distinguished road
Default 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:
var incomingmsg = msg;
In the first destination transformer put:
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!
Reply With Quote

destination, javascript, source, transformer

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 01:50 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation