Announcement

Collapse
No announcement yet.

globalChannelMap not working

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

  • 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.

  • #2
    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, 06:18 AM.

    Comment


    • #3
      Thanks....Can we use globalChannelMap to pass the array?

      Comment


      • #4
        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, 06:40 AM.

        Comment

        Working...
        X