Checking PV1.45 for future date to Suppress

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Checking PV1.45 for future date to Suppress

  • Creator
    Topic
  • #53818
    Danny Wheeler
    Participant

      I need to check PV1.45 for a future date and suppress those messages on an ADT feed.  What would be the best way to accomplish this?

    Viewing 10 reply threads
    • Author
      Replies
      • #79043
        Kevin Crist
        Participant

          Depends on who you talk with. Some prefer to KILL with tcl and some prefer to SUPPRESS with an Xlate. I personally would just make a tcl KILL script to KILL so it can be killed before any manipulation.

        • #79044
          Jim Kosloskey
          Participant

            I suspect you also want to know how to do that in Tcl.

            What I would do is to convert the current date and the PV1 date to internal date in Tcl (epoch time) then check to see if the PV1 date is greater than the current date. Use the Tcl clock command for the conversion.

            As Kevin indicated, this can be done in Tcl pre Xlate or with Tcl inside the Xlate. If you feel comfortable with writing UPoC Tcl code then it is more efficient to do it pre Xlate. However, if you are more comfortable with xltp type Tcl (Xlate based) then do it there.

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

          • #79045
            Russ Ross
            Participant

              These URLs contain specific examples plus actual code of what Jim is talking about.

                  https://usspvlclovertch2.infor.com/viewtopic.php?t=2828

                  https://usspvlclovertch2.infor.com/viewtopic.php?t=1562

              In my examples at these URLs I show how I KILL messages that are older than 6 hours by using a trxID proc.

              There is also an example by another poster of a very straight forward proc if that is your preference.

              Here we try to only use argument driven reusable procs that go in the master site, which might seem excessive to look at them but in the long run we feel it pays off.

              Russ Ross
              RussRoss318@gmail.com

            • #79046
              Danny Wheeler
              Participant

                Thanks guys.  This was exactly what i was looking for.  I have never used system time with TCl before and didn’t know where to start.

              • #79047
                Danny Wheeler
                Participant

                  So I created a proc and tested it in TCLsh85 and it works perfect.  But when I add it my Xlate and run it through testing tool I get the attached error.  Am I using Clock wrong?  I am on v5.8.5 of Cloverleaf.

                • #79048
                  Kevin Crist
                  Participant

                    i dont see anything that matches to the very last bracket/brace

                  • #79049
                    Danny Wheeler
                    Participant

                      Sorry probably made it in there with a copy/paste.  I removed this brace and am still receiving the same error though.

                    • #79050
                      Kevin Crist
                      Participant

                        Not sure if these examples help, the first one is from Xlate while the second one is from tclproc

                        lassign $xlateInVals t1

                        set t1 [format %-014s $t1]

                        regsub — {(d{8})(.*)} $t1 {1 2} t1

                        set tout [clock format [clock scan $t1] -format “%D %R”]

                        set xlateOutVals

                          regsub — {(d{8})(d{2})(d{2})}  $datetime {1 2:3:4} datetime

                           

                              set datetime [clock format [clock scan $datetime] -format “%m/%d/%Y %H:%M:%S”][/code]

                      • #79051
                        Danny Wheeler
                        Participant

                          Sorry probably made it in there with a copy/paste.  I removed this brace and am still receiving the same error though.

                        • #79052

                          Danny, when you pass an HL7 date to tcl clock, you must split the date and time up. Ex. “20130901 0901”. I use string range to do this.

                          Code:

                          set dateTime [lindex $xlateInVals 0]
                          set dateTime “[string range $dateTime 0 7] [string range $dateTime 8 11]”
                          set dateTime [clock scan $dateTime] ;# seconds since epoch, used for date logic

                          -- Max Drown (Infor)

                        • #79053
                          Danny Wheeler
                          Participant

                            That’s what I ended up doing.  I guess I should have replied back to this in case someone else had my same issue and came across this thread.  I am attaching my XLTP if anyone else has a need for this.  Thank you everyone for your help!

                        Viewing 10 reply threads
                        • The forum ‘Cloverleaf’ is closed to new topics and replies.