Filter Future PV1-44 Field

Clovertech Forums Cloverleaf Filter Future PV1-44 Field

  • Creator
    Topic
  • #115765
    Betty
    Participant

      Hi,

      I want to start out by saying I’ve only received the first level of Cloverleaf training. I am still very new to the product and I am not well versed in tcl.

      I am working on an ADT interface and need a way to filter messages that contain a future date in the PV1-44 field. What is the best way to do this?

    Viewing 2 reply threads
    • Author
      Replies
      • #115766
        Jim Kosloskey
        Participant

          You will need some tcl even if you do the majority of the filtering logic in the Xlate.

          If you filter using the Xlate, you will need Tcl to determine if the date in PV1-44 is greater than today’s date.

          You can either have some inline Tcl code in the Xlate or invoke a XPM type proc in a COPY or CALL Action which returns a value (Y or N possibly) depending on the relationship of PV1-44 to todays date putting the result in a temp variable (let’s call it @suppress).

          Then in an IF Action after the Tcl proc is invoked, check @suppress (or whatever temp variable you used) is eq =Y (assuming Y means PV1-44 is greater than todays date).

          If it is equal then issue a SUPPRESS – else – build the message.

          If you have many ADT Xlates then this logic will need to be in each Xlate – or you can have a filtering Xlate (where BULKCOPY would be used in the else above) chained with the actual Xlates that build the ob messages. There then would only be one filtering Xlate.

          OR you can use nothing but Tcl placed in the pre-Xlate UPoC which finds PV1-44, tests it for greater than todays date and KILLs or CONTINUEs the message depending on the result.

          Perhaps a member out there has a proc that does what you want and is willing to share it.

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

          • #115779
            Betty
            Participant

              Jim,

              Thank you for pointing me in the right direction. I would prefer to do this pre-Xlate, but my tcl is limited. I do hope someone can provide something for me to pay with. In the mean time I will work on the Xlate.

          • #115768
            Charlie Bursell
            Participant

              What is format of the date in PV1-44 field?  To do map math that is needed.

              • #115780
                Betty
                Participant

                  Charlie,

                  The format varies between YYYYMMDD and YYYYMMDDHHMM. The data comes from our partner hospital, so I am not sure why some have hours and minutes and others do not.

              • #115787
                Charlie Bursell
                Participant

                  Simple.  Just a few lines of code

                  Assume you have PV1.44 in a variable

                  regsub — {(\d{8})(.*)} $PV1_44 {\1 \2} msgDate

                  set msgSecs [clock scan $msdDate]

                  set nowSecs [clock scan now]

                  if {$msgSec > $nowSecs} {

                  KILL MESSAGE

                  } else {
                  CONTINUE MESSAGE

                  }

                  You should be able to code this

                  The above will work whether YYYYMMDD or YYYYMMDDHHMMSS

                   

                   

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