web stats
sourceChannelId and sourceMessageId - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 11-25-2014, 01:15 PM
StickyBandit's Avatar
StickyBandit StickyBandit is offline
Mirth Guru
 
Join Date: Aug 2013
Location: Home Alone
Posts: 948
StickyBandit is on a distinguished road
Wink sourceChannelId and sourceMessageId

Suppose you have a 3 channel flow.
If you send in
sourceChannelId and
sourceMessageId
in the message Metadata of a channel writer to the 3rd channel, it works.

I noticed that if you do not send them they still have values of the second channel.

So it appears that any message metadata will overwrite the sourcemap fields after mirth has populated them with default values.
Correct?
Reply With Quote
  #2  
Old 11-25-2014, 01:18 PM
StickyBandit's Avatar
StickyBandit StickyBandit is offline
Mirth Guru
 
Join Date: Aug 2013
Location: Home Alone
Posts: 948
StickyBandit is on a distinguished road
Default

In contrast if your source connector puts values under the same keys in the channelmap and in your destinations use $("myKey") instead of $s("myKey") you will get the value from the source connector rather than the one in the sourcemap.
Reply With Quote
  #3  
Old 11-26-2014, 05:43 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

Quote:
Originally Posted by StickyBandit View Post
Suppose you have a 3 channel flow.
If you send in
sourceChannelId and
sourceMessageId
in the message Metadata of a channel writer to the 3rd channel, it works.

I noticed that if you do not send them they still have values of the second channel.

So it appears that any message metadata will overwrite the sourcemap fields after mirth has populated them with default values.
Correct?
The "sourceChannelId(s)" and "sourceMessageId(s)" variables are metadata that the Channel Writer specifically includes when sending to another channel. So even if you include your own values, they will simply be overwritten by the dispatcher.

Quote:
Originally Posted by StickyBandit View Post
In contrast if your source connector puts values under the same keys in the channelmap and in your destinations use $("myKey") instead of $s("myKey") you will get the value from the source connector rather than the one in the sourcemap.
I don't think that's "in contrast" to anything; it's a completely different subject. When you use the generic "$" function, it checks the source map after it checks the connector/channel map.
__________________
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
  #4  
Old 11-26-2014, 07:56 AM
StickyBandit's Avatar
StickyBandit StickyBandit is offline
Mirth Guru
 
Join Date: Aug 2013
Location: Home Alone
Posts: 948
StickyBandit is on a distinguished road
Default

I found the opposite to be true.

"The "sourceChannelId(s)" and "sourceMessageId(s)" variables are metadata that the Channel Writer specifically includes when sending to another channel. So even if you include your own values, they will simply be overwritten by the dispatcher."

The ones you send will overwrite the dispatcher ones.
Reply With Quote
  #5  
Old 11-26-2014, 08:03 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road
Default

Quote:
Originally Posted by StickyBandit View Post
I found the opposite to be true.

"The "sourceChannelId(s)" and "sourceMessageId(s)" variables are metadata that the Channel Writer specifically includes when sending to another channel. So even if you include your own values, they will simply be overwritten by the dispatcher."

The ones you send will overwrite the dispatcher ones.
Sorry should have clarified, the ones you specify in the Message Metadata table will overwrite the variables injected by the dispatcher. However if you overwrite them in the channel map / whatever but don't include them in the Message Metadata table, then nothing will be overwritten.

If you want to include your own values, it might be best to use different variable names.
__________________
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
  #6  
Old 11-26-2014, 08:08 AM
StickyBandit's Avatar
StickyBandit StickyBandit is offline
Mirth Guru
 
Join Date: Aug 2013
Location: Home Alone
Posts: 948
StickyBandit is on a distinguished road
Thumbs up

Okay, that makes more sense. And normally different variable names would be a good choice, but in our case we want the same names but we want the data to reflect the very first channel in the flow and we have to put these into the Message Metadata table, otherwise we just get the last channel info.
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 11:20 PM.


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