web stats
How to pass variables between 2 function type code templates - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-13-2019, 11:23 PM
devroy1899 devroy1899 is offline
What's HL7?
 
Join Date: Apr 2019
Posts: 2
devroy1899 is on a distinguished road
Question How to pass variables between 2 function type code templates

Hello,

My channel is receiving HL7 messages and I have 2 transformers in my channel. I am capturing all the data from the HL7 message in one transformer like
- var vACCNo= msg['PID']['PID.17']['PID.17.1'].toString();
- var vSTATE=msg['PID']['PID.11']['PID.11.4'].toString();
- ....
In the second transformer I am pushing all this data into a external DB as insert statement like insert into table x values (vACCNo, vSTATE....)

In the above design without doing anything data captured in first transformer is available in second and it works. Now I am planning to get rid of these 2 transformers and move these into code templates, where I am planning to create a separate function for each of these transformer.

But how I can pass variables captured in first function to second one ?

Thanks
Reply With Quote
  #2  
Old 04-17-2019, 07:32 AM
stormcel stormcel is offline
OBX.3 Kenobi
 
Join Date: Mar 2010
Location: Phoenix
Posts: 150
stormcel is on a distinguished road
Default

globalMap.put(key,value);
globalMap.get(key);
Reply With Quote
  #3  
Old 04-17-2019, 11:48 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 688
agermano is on a distinguished road
Default

See answer at https://stackoverflow.com/questions/...code-templates
Reply With Quote
Reply

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 05:24 AM.


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