web stats
Destination Filter based on time of day - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 09-04-2013, 10:40 AM
Jaypell22 Jaypell22 is offline
OBX.1 Kenobi
 
Join Date: Jul 2011
Location: Upstate NY
Posts: 33
Jaypell22 is on a distinguished road
Default Destination Filter based on time of day

Good Morning.

I am trying to figure out the best way to limit sending to a specific destination based on time.

I suppose this can be done as a filter however I do not know where to begin with the coding and did not see anything specific in the message boards other than scheduling a channel to deploy/undeploy at certain times. I would prefer to not do that as there are other destinations this channel sends ORM messages to.

This is exactly what I am trying to achieve:

ONLY send orders to destination "A" from 5pm through 8am 7 days a week.
OR if easier - DO NOT send orders to destination "A" from 8am-5pm daily.

Thanks for any help with this solution.

Jay
Reply With Quote
  #2  
Old 09-04-2013, 10:49 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

You can use Joda-Time:

Code:
var hour = new org.joda.time.DateTime().hourOfDay().get();
return hour < 12 || hour >= 17;
__________________
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
  #3  
Old 09-06-2013, 01:37 PM
Jaypell22 Jaypell22 is offline
OBX.1 Kenobi
 
Join Date: Jul 2011
Location: Upstate NY
Posts: 33
Jaypell22 is on a distinguished road
Thumbs up

Thanks Nick! This was perfect.
Reply With Quote
Reply

Tags
destination, time, time limit, time of day

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 03:18 AM.


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