2

Is there a method/function available in Mirth Connect that will list or output the contents of the Global Map? I would like both the 'key' and the value of the key.

Tom Gilbert
  • 21
  • 1
  • 2

3 Answers3

4

Following code will print the key as well as value of global map variable in mirth

 for each(key in globalMap.getVariables().keySet().toArray())
 logger.info(key + ': ' + globalMap.get(key));
Yogendra Joshi
  • 228
  • 1
  • 8
2

put ing the global map didn't work for me.. something like this in a javascript transformer anywhere in the channel will get you a listing of everything available to you in each scope, after a message has been processed, in the Mappings tab:

for each(variable in responseMap)
     channelMap.put('R_' + variable.toString(),variable);
for each (variable in channelMap)
     channelMap.put('C_' + variable.toString(),variable);
for each (variable in globalMap)
     channelMap.put('G_' + variable.toString(),variable);

HTTP 501
  • 126
  • 15
0

Clumsy, but stick it in the channel map, and you can view it by looking at the Mapping tab when viewing a message (via dashboard).

channelMap.put('globalMap', globalMap);
dividius
  • 820
  • 6
  • 16