web stats
Iterate through ChannelMap values - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 07-22-2015, 09:34 AM
krmurrell krmurrell is offline
OBX.2 Kenobi
 
Join Date: Mar 2013
Location: London, UK
Posts: 61
krmurrell is on a distinguished road
Default Iterate through ChannelMap values

I create a series of entries in the channelMap in a source transformer, and I would like (in a destination) to read through each of these in turn.

I can't predict the variable names, so ideally need something like a foreach construct to read through each of the values in turn?

Any ideas folks?

Regards, Kevin
Reply With Quote
  #2  
Old 07-22-2015, 09:40 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

The maps all implement the Map interface, so you can, for example, do this:

Code:
for each (entry in channelMap.entrySet().toArray()) {
    var key = entry.getKey();
    var value = entry.getValue();
}
There's also keySet() and values() to return only the keys or values respectively. Note that the maps are not linked, so there is no determinate order of keys or values.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
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 08:30 AM.


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