Suppress based on date

Clovertech Forums Cloverleaf Suppress based on date

  • Creator
    Topic
  • #120302
    Rich
    Participant

      Team,

      I need to suppress messages based on date, meaning if the message coming in is older than 30 days.  I don’t know how to format the condition based on the MSH.7 value.  Can you assist?

    Viewing 3 reply threads
    • Author
      Replies
      • #120303
        Jim Kosloskey
        Participant

          Do you want to do this in an Xlate or Tcl?

          If in an Xlate and depending on what release of Cloverleaf you are using, the STRING Action and some other Actions could possibly do the trick.

          A lot depends on how the MSH-7 field is really formatted in the messages. Not all systems follow the Date/Time format prescribed for the MSH Date/Time field. SO how is yours formatted?

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

          • #120304
            Rich
            Participant

              Hi Jim!

              I should have known that you and that gorgeous car would show up!  I’m using version 20.1, and MSH.7 is formatted 20221209091927 – Year/month/day/time.  Thank you so much for your time!

          • #120306
            Jim Kosloskey
            Participant

              I think the Xlate STRING Action xlateStrCalcAge Function should work.

              Oh and thanks for the compliment regarding my 1974 DeTomaso Pantera L.

              • This reply was modified 1 year, 10 months ago by Jim Kosloskey.

              email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

            • #120311
              Jim Kosloskey
              Participant

                I actually checked that STRING Function and it reports back number of years so that won’t work for you.

                email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

              • #120312
                Charlie Bursell
                Participant

                  Why would you want to incur all of the processing up through Xlate just to kill it?  A simple proc in the IB tab would solve it.  Just extract MSH.7, do the math and return KILL if over 30 days.

                  Take a look at the clock command for how to do this.  Off the top of my head see below.  There may be more eloquent methods.

                  set msh7 20230210123212          ;#MSH 7 value

                  # make it scanable then get seconds
                  set then [clock scan “[string range $msh7 0 7] [string range $msh7 8 end]”]

                  # Seconds now
                  set now [clock seconds]

                  # Number of seconds in 30 days
                  set 30days 2592000

                  if {[expr $now – $then] > $30days} {  return KILL }

                   

              Viewing 3 reply threads
              • You must be logged in to reply to this topic.