Calculating hours from Appointment
I bet there's a better way of doing this:
if text(duration(Appointment)) > "2:00" then
"More than two hours"
else
if text(duration(Appointment)) > "1:00" then
"Two hours"
else
if text(duration(Appointment)) = "1:00" then
"One hour"
end
end
end
end
I thought saying if text(duration(Appointment)) > "1:00" and ≤ "2:00" that would be better but I can't figure out how to write that.
I'm trying to bill by the hour so even if the appointment is 1:30 the answer should be "Two hours".
Or should I stick with my longwinded code?!
Thanks
3 replies
-
May I recommend another way. You can use the ceil() command. It would look something like:
let x := number(duration(Appointment) / 3600000); ceil(x)
In Ninox, time is kept in milliseconds. There is 3,600,000 milliseconds in an hour.
So on line 1, we take our duration() time and divide by 3600000. Then we convert that result into a simple number. Otherwise Ninox continues to treat the result as time.
Then in line 2 we use the ceil() command to tell Ninox to always round up the results of line 1.
I don't know how exact you track the appointments, but a limitation is that even 1 minute over 1 hour will push the result to 2.
Content aside
- 1 yr agoLast active
- 3Replies
- 105Views
-
3
Following