Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

variable with negative numbers comparision

I have a variable which is defined as follows

vTimeDiff = Interval([Deliver By Time]- [Delivered Time],'mm')

This gives me the time interval in minutes between the two dates as -1094

If I use this in an if statement and compare to a negative value I get wrong results

example

if($(vTimeDiff) < -120,1,0)  returns a result = 0, should retuirn 1 since -1094 < -120

When I hardcode the value of the variable to -1094 rather than the interval function

The if statement evaluates correctly

vTimeDiff = -1094

example

if($(vTimeDiff) < -120,1,0)  returns a result = 1, which is correct

Would appreciate any help on this matter ?

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hi interval returns time number

so the display shows -1094

bu actually it around 18 hours which translate to around 0.75 in numeric values

if you want to translate it to numeric minutes

just use

vTimeDiff = Interval([Deliver By Time]- [Delivered Time],'mm')*1440

View solution in original post

3 Replies
MK_QSL
MVP
MVP

I have create similar function in my PC and working fine. Can you please upload your sample data file?

lironbaram
Partner - Master III
Partner - Master III

hi interval returns time number

so the display shows -1094

bu actually it around 18 hours which translate to around 0.75 in numeric values

if you want to translate it to numeric minutes

just use

vTimeDiff = Interval([Deliver By Time]- [Delivered Time],'mm')*1440

Not applicable
Author

Thanks Liron, that works perfectly