Expand my Community achievements bar.

Display numeric value as 0 if negative

Avatar

Former Community Member
I just started working with Designer and am trying to put together a time sheet for our office. I would like to use a formula to calculate overtime hours (in excess of 8 hours/day). I tried using "regulartime - 8" as my formula but if the regular time is less than 8 I show a negative number in the overtime column. This then affects my weekly totals. Is there a way to have any value of 0 or less than zero (negative) display as "0"?



Thank you for any help you can give.
1 Reply

Avatar

Former Community Member
i guess you could add a javascript to the calculate event of the field:



//************

if (this.rawValue < 0)



this.rawValue = 0;

//************



or you could add something like this:



//************

if (regulartime > 8 )



overtime = regulartime - 8;



else



overtime = 0;

//************