4 Replies Latest reply: Dec 18, 2012 9:23 AM by Jonathan Ditchfield RSS

    Expression doesn't look at date

      Hi,

       

      In a text box I have the below expression:

       

      =Interval(

                (RangeMin(frac(timestamp(vJD_TIME, MakeTime(18)))))

                - RangeMax(frac(logdate_true), MakeTime(8))

                //+ (NetWorkDays(logdate_true, vJD_TIME) * MakeTime(0)) // Only 10 hours per whole day

      )

       

      In my Load Script I have set the following variable LET vJD_TIME = now()

       

      In my text box I am trying to calcuate the difference between the current system time (variable: vJD_TIME) minus the time the call was logged (field logdate).

       

      This works correctly when logdate is the same date as the current system time, however when the logdate is another date ie: 16/12/2012 16:30:00, it doesnt take the date into account and sometimes shows a minus figure.

       

      How can I correct this?

       

      Regards,

       

      Jon Ditchfield

        • Re: Expression doesn't look at date
          Miguel Angel Baeyens de Arce

          Hi Jon,

           

          The same expression (some parentheses are missing, probably a typo when pasting the code) is working for me, and it does return a negative value, but for me that makes sense. I mean, it's 13:30, so the RangeMin() with 18:00 will return 13:30.

           

          The RangeMax() between 16:30 according to your example, and 08:00 will return 16:30. So 13:30 - 18:30 = -03:00 (negative)

           

          If that logic is correct for what you are looking for, wrap the whole expression with Fabs() to get the absolute value and Interval() to make it look like hh:mm:ss:

           

          =Interval(Fabs(Interval(
                    RangeMin(frac(timestamp(vJD_TIME)), MakeTime(18))
                    - RangeMax(frac(timestamp('16/12/2012 16:30:00')), MakeTime(8))
          )))
          

           

          Hope that helps.

           

          Miguel