If then calculations across apps
I'm trying to calculate hours in a work order based off of 2 calculation fields that will pull data from an associated app called time slips. Time slips has a duration field and a category field that will determine the "type" of billable hours. So in the work order we have a calc for "Programmer Hours" and "Technician Hours", when an employee is filling out a time slip the category field will determine where these hours calculate to. I'm thinking I would have to create a similar calculation in both fields in the WO. I'm on mobile right now so I won't even attempt what I would try but I'm curious if this can be done across apps.
-
Hi Paul,
for the 2 calculation fields in WO you can use:
Field 1 for Programmers:var type = @all of category field; var dur = @all of duration field; var proghrs = 0 for(var i = 0; i < type.length; i++){ if(type[i] == "Programmer Hours"){ proghrs += dur[i] } };
Field 2 for Technicians:
var type = @all of category field; var dur = @all of duration field; var techhrs = 0 for(var i = 0; i < type.length; i++){ if(type[i] == "Technician Hours"){ techhrs += dur[i] } };
Rainer
rg@delos-consulting.com -
Can that happen that a duration field is empty? When a time slip is created both fields (type and duration) should have a value (even if the value is 0).
If it can happen, that duration is empty, it can rise problems for the whole calculation. You can a avoid these issues by
a) making the duration field a required field or
b) creating a calcution field (e.g. called "Duration Mirror") in the Time slip app, which checks if the duration field is empty and then shows 0:@duration field == null ? 0 : @duration field
And then use this field "Duration mirror" in the calcluation fields in WO: instead "@all of duration field" use "@all of duration mirror"
Rainer
rg@delos-consulting.com
Please sign in to leave a comment.
Comments
5 comments