Math Function: Subtract

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Math Function: Subtract

  • Creator
    Topic
  • #55356
    Darcy Kemp
    Participant

      Hello,

      I would like to use the GUI translation math function to subtract but it looks like a negative value when I do.  I take YYYYMMDD from MSH 7, then subtract 10 (days) and compare, < or > the value to another YYYYMMDD to see if it falls between those two dates.  I can do it if I ADD, but Subtract does not.  I may have the source incorrect, where as I know how to define the source side to add.  Any help is appreciated.  Thank you.

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

          The Source should look like this:

          ….MSH#7

          =1

          If you have it reversed then you would be subtracting the date from 1 which should result in a negative number.

          Moreover I don’t think that is the way you want to do this anyway.

          What if the date is 20170401 and you subtract 2?

          Your result would be 20170399 not even a valid date.

          Some Tcl will be needed here. If you would like a xltp type proc which allows you to adjust a date returning a proper adjusted date email me and I will send you one.

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

        • #85059
          Darcy Kemp
          Participant

            Good catch, I was going off an old post from Dennis that had the dates stored as variables, but that is a valid point.

            Yes, I would appreciate the tcl.  thanks.

          • #85060
            Jim Kosloskey
            Participant

              email me so I have your email address.

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

            • #85061
              Darcy Kemp
              Participant

                Thanks So Much !

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