web stats
Replacing messageObject with "mirth_type" - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 02-16-2015, 04:44 AM
RobinP RobinP is offline
OBX.1 Kenobi
 
Join Date: Oct 2007
Location: England UK
Posts: 43
RobinP is an unknown quantity at this point
Default Replacing messageObject with "mirth_type"

Hi,

I've just upgraded to Mirth Connect 3.1.1 on our test machine to test before rolling out to production.
Our current production versions are Mirth Connect 2.2.1

I have a number of channels which use a filter to determine the message types to allow through.

I have seen the message that the messageObject.getType() is deprecated and should be replaced by the "mirth_type". this is fine but I cannot any documentation on the syntax for the "mirth_type" variable

See below for the filter code:-
==============================
// this filter will only allow in ADT A01, A04 & A08 messages


logger.info('Message Type = ' + messageObject.getType() );


if (messageObject.getType() == 'ADT-A04' || messageObject.getType() == 'ADT-A08'|| messageObject.getType() == 'ADT-A01' )
return true
else
return false;
================================

Can anyone help with replacing this code with the recommended new way or has anyone done something similar.

Many thanks Robin
Reply With Quote
  #2  
Old 02-16-2015, 08:27 AM
RobinP RobinP is offline
OBX.1 Kenobi
 
Join Date: Oct 2007
Location: England UK
Posts: 43
RobinP is an unknown quantity at this point
Default Mirth_type example

Hi,

I resolved my own question, by guesswork and trial and error.

I used the Rule Builder in the filter. The syntax for mirth_type variable is

$('mirth-type')

Then selected the contain option and entered 3 separate strings relating to the ADT message types I wanted to filter on. Screenshot attached of the filter.

Robin
Attached Images
File Type: png MirthChannelFilter3.png (65.1 KB, 46 views)

Last edited by RobinP; 02-16-2015 at 08:36 AM.
Reply With Quote
  #3  
Old 02-16-2015, 05:36 PM
wayneh wayneh is offline
OBX.3 Kenobi
 
Join Date: May 2012
Posts: 102
wayneh is on a distinguished road
Default

More specifically, mirth_source, mirth_version, and mirth_type are stored in the connector map. You can verify in the message browser under the Mappings tab.

The syntax you're using is fine except that it will also look in the response map before checking the connectorMap, and if it doesn't find it in the connector map it will check the other maps as well. So if you want to be more precise about it you should use connectorMap.get('mirth_type') or $co('mirth_type').
Reply With Quote
  #4  
Old 02-17-2015, 09:35 AM
RobinP RobinP is offline
OBX.1 Kenobi
 
Join Date: Oct 2007
Location: England UK
Posts: 43
RobinP is an unknown quantity at this point
Default

Thanks Wayne for that clarification around the connector map. I shall update the channel. Is there any documentation around this subject other than the Mirth 3.1 User guide?

Robin
Reply With Quote
Reply

Tags
"mirth_type", messageobject.gettype()

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:49 AM.


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