web stats
Mapping variables from preprocessor - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 01-08-2008, 11:04 AM
skrugg skrugg is offline
Mirth Newb
Join Date: Sep 2006
Posts: 16
Default Mapping variables from preprocessor

Is it possible to read/write to/from the channel or global maps in a preprocessor script? I did a forum search but couldn't find a definitive answer.

Reply With Quote
Old 12-19-2013, 09:31 AM
ben.germann ben.germann is offline
What's HL7?
Join Date: Oct 2013
Posts: 4
ben.germann is on a distinguished road
Default I am also having this problem

This is my preprocessor:

// Modify the message variable below to pre process data
logger.info('is this running');
return message;

I am having issues with defining global values in the preprocessor.
The only information the above code gives in the Log Information is the following error:

[2013-12-19 17:53:19,355] ERROR (com.mirth.connect.server.util.JavaScriptUtil:264) : Error executing Preprocessor script from channel: 172bd389-d686-4ac6-b705-6b2e6a724088
com.mirth.connect.server.MirthJavascriptTransforme rException: SOURCE CODE:

ReferenceError: "Patient_ID" is not defined.

I cut out some of the information; the big issue for me is the error name. I literally just get done defining the variable and it kills the whole preprocessor saying it's undefined.
This also kills my code as I need to call the variable in the source transformer before defining it further down the line.

Any suggestions?

EDIT: got help on the IRC channel. have to watch my quotes in the future.
So yes, globals can be changed and called in the preprocessor

Last edited by ben.germann; 12-19-2013 at 11:28 AM.
Reply With Quote
Old 12-22-2013, 02:13 PM
rohit.chawla12 rohit.chawla12 is offline
OBX.2 Kenobi
Join Date: Oct 2013
Location: Australia
Posts: 72
rohit.chawla12 is on a distinguished road

I am having the following line of code in preprocessor of my channel where I am writing to the global channel map variable.

globalChannelMap.put('InitMirthServerLocation', 'LAV Mirth development server');

And I am able of get the value in destination transformer javaScript globalChannelMap.get('InitMirthServerLocation');
Reply With Quote
Old 05-26-2014, 11:03 PM
Jon Blanchard Jon Blanchard is offline
OBX.1 Kenobi
Join Date: Mar 2011
Posts: 38
Jon Blanchard is on a distinguished road

To access the value stored in a global variable, use this form:

$('<GlobalVarName>')  <-- Note the single quotes
All variables in all contexts are referenced this way.


Last edited by Jon Blanchard; 05-27-2014 at 01:24 AM.
Reply With Quote

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
preprocessor with "return message;" panickc Support 2 01-22-2009 11:51 AM
preprocessor stops processing? keith_gaddis Support 2 02-01-2008 08:12 PM
XML-izer at preprocessor stage ricber Support 0 01-31-2008 02:44 PM
SQL Variables not showing under Available Variables in 1.4 bobbie Support 4 04-23-2007 05:35 PM
Regarding Preprocessor Tyree731 Support 2 04-22-2007 08:55 PM

All times are GMT -8. The time now is 06:14 AM.

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