Hi,
Out of a desire to learn, partial boredom, and a double-dog dare, I decided to create a thread topic to list some things that I find useful when dealing with Mirth, creating Channels, or fine-tuning the database.
First, I'd figure I would start out with some functions that some may find useful when developing channels.
Feel free to use them, tweak them, or add more to this thread of others to gaze upon. I hope to start other threads with other tools/scripts/code examples to assist in making our daily Mirth Connect experience that more enjoyable and less migraine inducing.
These functions can be defined and called from within a single Channel itself, or placed into the Code Template section for use throughout all of your Channels.
1. Determine a Channel's status
Purpose: To determine the current state of a channel.
Sometimes, you need to know the status of a certain channel, from within another channel. To accomplish this, you can use the following to see if the channel is :
-STARTED
-STOPPED
-PAUSED
-NA (Non-available)
If you do not know your channel_id, you can view it next to the channel_name on the 'Channels' section of your Mirth Connect Administrator.
Out of a desire to learn, partial boredom, and a double-dog dare, I decided to create a thread topic to list some things that I find useful when dealing with Mirth, creating Channels, or fine-tuning the database.
First, I'd figure I would start out with some functions that some may find useful when developing channels.
Feel free to use them, tweak them, or add more to this thread of others to gaze upon. I hope to start other threads with other tools/scripts/code examples to assist in making our daily Mirth Connect experience that more enjoyable and less migraine inducing.
These functions can be defined and called from within a single Channel itself, or placed into the Code Template section for use throughout all of your Channels.
1. Determine a Channel's status
Purpose: To determine the current state of a channel.
Sometimes, you need to know the status of a certain channel, from within another channel. To accomplish this, you can use the following to see if the channel is :
-STARTED
-STOPPED
-PAUSED
-NA (Non-available)
Code:
function GetChannelState(channel_id) { var channel_status = "NA"; var channel_count = parseInt(Packages.com.webreach.mirth.server.controllers.ChannelStatusController.getInstance().getChannelStatusList().size()); for(var i=0;i<channel_count;i++) { if (channel_id == Packages.com.webreach.mirth.server.controllers.ChannelStatusController.getInstance().getChannelStatusList().get(i).getChannelId()) { channel_status = Packages.com.webreach.mirth.server.controllers.ChannelStatusController.getInstance().getChannelStatusList().get(i).getState(); } } return channel_status; }
Comment