web stats
globalChannelMap not working - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-18-2014, 06:53 AM
johnjohn johnjohn is offline
OBX.1 Kenobi
 
Join Date: Aug 2014
Posts: 31
johnjohn is on a distinguished road
Default globalChannelMap not working

globalChannelMap.get("counter0");
if (counter0 == undefined)
{
var counter0 = parseInt(FileUtil.read('//export//netapp2//dept//IT//Mirth-Test//counter//good.txt'));

}
var counter0 = parseInt(counter0);
var counter0 = counter0 + 1;
globalChannelMap.put("counter0", "counter0");

I am using Mirth 3.0.1.7051. I tried to use globalChannelMap in the pre-processor and it did not work. When the program first go in, I want to read the counter from a file and add 1 to the counter. The second time it goes in, it should have the counter0 defined. But it is not. I am not sure what I did wrong. Your help is greatly appreciated.
Reply With Quote
  #2  
Old 12-18-2014, 07:07 AM
rodrosa rodrosa is offline
OBX.2 Kenobi
 
Join Date: Jul 2013
Posts: 79
rodrosa is on a distinguished road
Default

Quote:
Originally Posted by johnjohn View Post
globalChannelMap.get("counter0");
if (counter0 == undefined)
{
var counter0 = parseInt(FileUtil.read('//export//netapp2//dept//IT//Mirth-Test//counter//good.txt'));

}
var counter0 = parseInt(counter0);
var counter0 = counter0 + 1;
globalChannelMap.put("counter0", "counter0");

I am using Mirth 3.0.1.7051. I tried to use globalChannelMap in the pre-processor and it did not work. When the program first go in, I want to read the counter from a file and add 1 to the counter. The second time it goes in, it should have the counter0 defined. But it is not. I am not sure what I did wrong. Your help is greatly appreciated.
of course.. you are checking your globalmap but dont do anything with that. Also, you have others programing logic errors.

Change it to:

Code:
var counter0;

if (globalChannelMap.get("counter0") != undefined){
counter0 = globalChannelMap.get("counter0");
counter0 = parseInt(counter0) + 1;

}else{
counter0 = parseInt(FileUtil.read('//export//netapp2//dept//IT//Mirth-Test//counter//good.txt'));
}

globalChannelMap.put("counter0", counter0);

Last edited by rodrosa; 12-18-2014 at 07:18 AM.
Reply With Quote
  #3  
Old 12-18-2014, 11:28 AM
johnjohn johnjohn is offline
OBX.1 Kenobi
 
Join Date: Aug 2014
Posts: 31
johnjohn is on a distinguished road
Default

Thanks....Can we use globalChannelMap to pass the array?
Reply With Quote
  #4  
Old 12-19-2014, 07:36 AM
rodrosa rodrosa is offline
OBX.2 Kenobi
 
Join Date: Jul 2013
Posts: 79
rodrosa is on a distinguished road
Default

Yes.. You can put any value, like a object, into a MAP, always passing KEY (to retrieve your object later) and an VALUE (the value of that key).

Last edited by rodrosa; 12-19-2014 at 07:40 AM.
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 09:52 AM.


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