Discussions

Conditional IF statement with a calculation

  • 1.  Conditional IF statement with a calculation

    Posted 05-09-2017 13:53
    I am trying to setup a field that calculates how long employees were working for and auto subtract how long they were on lunch for based on their shift length. The two fields I am using are [Time In] and [Time Out] and both are type Time Of Day. What I am currently using is as follows,

    var Number los = (ToMinutes([Time Out]-[Time In])/60);

    if (los > 9, los-1,
    los < 9 and los >= 8, los-0.5,
    los < 8, los,0);