Check a (PV1-44) date is less then a current date ?

Homepage Clovertech Forums Read Only Archives Cloverleaf Tcl Library Check a (PV1-44) date is less then a current date ?

  • Creator
    Topic
  • #51382
    Ganesan Murali
    Participant

    In TCL

    how to check a PV1-44 admit date  is less then a current date ?

    If the Pv1-44 is less then current date no need to change the Pv1-44.

    If the Pv1-44 is greater then current date need to change the Pv1-44 as blank.

    How do we achieve this in tcl ?

    Regards

Viewing 4 reply threads
  • Author
    Replies
    • #70010

      Ganesan, you can use the tcl clock command. Let me know if you’d like some examples.

      -- Max Drown (Infor)

    • #70011
      Ganesan Murali
      Participant

      Can you pls give me some samples ? Tks.

    • #70012
      Russ Ross
      Participant

      I use our callable generic proc ( oth_chk_time_span.tcl ) for things like this.

      It is posted at this URL

      <a href="http://clovertech.infor.com/viewtopic.php?p=11392#11392&#8243; class=”bbcode_url”>http://clovertech.infor.com/viewtopic.php?p=11392#11392

      Also, a search of clovertech will likely yield many useful examples as I recall posts about this topic over the years.

      Russ Ross
      RussRoss318@gmail.com

    • #70013

      Here’s a quick example of the basic idea. You’ll need to modify it for your own needs. And defintely check out the thread Russ mentioned. Clock scan takes a bit of time to get your mind around.

      Code:

      set tmp [clock format [clock scan “[string range [lindex $xlateInVals 0] 0 7] [string range [lindex $xlateInVals 0] 8 13]”] -format “%m/%d/%Y %H:%M:%S”]; set xlateOutVals [list $tmp]

      -- Max Drown (Infor)

    • #70014
      David Barr
      Participant

      There are at least two options.  You can use “clock scan” to convert the PV1 44 time to seconds and compare that to the current time in seconds, which is returned by “clock seconds”.  It might be slightly simpler to use “clock format” to convert the current time to the same format at PV1 44 and compare the fields.

      Code:

      if { “s$pv144” < [clock format [clock seconds] -format "s%Y%m%d%H%M%S"] } {
       …
      }

      I added an “s” character to each side of the test to make sure that I was doing a string comparison instead of a numeric comparison, because these numbers are big enough to overflow integer variables.  Maybe not necessary.

Viewing 4 reply threads
  • The forum ‘Tcl Library’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,129
Forums
28
Topics
9,301
Replies
34,447
Topic Tags
288
Empty Topic Tags
10