add system date and time to tnx

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf add system date and time to tnx

  • Creator
    Topic
  • #50038
    Mason Miller
    Participant

      I am trying to Add the system date and time to a tnx is thier a tcl I can use to do this?

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

          Mason,

          If you are in an Xlate, you can use one of the preset temp variables (I think it is @now but check to be sure).

          If you have to do this outside of an Xlate, then you will need to use Tcl.

          Someone may have a proc to do specifically what you want but in essence you would use the Tcl date command with appropriate arguments to get the structure you want.

          Jim Kosloskey

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

        • #64659
          Mason Miller
          Participant

            Thanks

          • #64660
            Craig Weldy
            Participant

              Mason,

                Here is a xlate script I use to do this.  In the Xlate, from the inbound side, just send “=currentdate” so it is obvious what the xlate line is for (xlateInVals is not used), then put this script in the preproc, and in the outbound side put in the field you want the current date to show up in.

                 You may need to modify the exec date command to get it in the formaty you want it to be in.

              ######################################################################

              # Name: Get_Current_Date

              # Purpose: Get the current system date and put it in the message

              # UPoC type: xltp

              # Args: none

              # Notes: All data is presented through special variables.  The initial

              # upvar in this proc provides access to the required variables.

              #

              # This proc style only works when called from a code fragment

              # within an XLT.

              #

              proc Get_Current_Date{} {

                 upvar xlateId       xlateId

               xlateInList   xlateInList

               xlateInTypes  xlateInTypes

               xlateInVals   xlateInVals

               xlateOutList  xlateOutList

               xlateOutTypes xlateOutTypes

               xlateOutVals  xlateOutVals

                  set currdt [exec date +20%y%m%d]

                  set xlateOutVals

                }

              Craig Weldy
              Senior Interface Analyst
              Beacon Health System
              South Bend, In, 46615

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