No announcement yet.

Destination Filter based on time of day

  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.


  • #2
    You can use Joda-Time:

    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.


    • #3
      Thanks Nick! This was perfect.