Calculated fields is a field type in layer settings. When using Calculated fields, you can set it to automatically calculate your measurements, coordinates, or create a math/logic expression.
NOTE: Access is restricted to Admins only
Overview
Calculated fields are for displaying information only, whereby the system will automatically calculate the information to display based on the value provided. These fields support variables (example: {id} or {field-name}) that can be added to the value and will tell the system how to insert the value of that variable into the calculated field value. Variables can be information about the feature (coordinates, length, ID, ...), other field values, or math/logic expressions to be evaluated.
Here's the equation for the "Total Labor Hours" Field:
{=datetime.parse("{work-ended}").subtract(datetime.parse("{work-started}")).TotalHours}
- {work-started} needs to be the REFERENCE NAME of the field you create
- Same with {work-ended}
- If you want to retrieve minutes, you would just change TotalHours to TotalMinutes in the equation
If this is a Work Order that takes multiple days (sessions) and hours to resolve, you would just duplicate the fields, with something along the lines of:
- Session 1 - Work Started
- Session 1 - Work Ended
- Session 2 - Work Started
- Session 2 - Work Ended
If you would like to have all of the sessions calculate into a single field, the equation would look like this:
{=(parse("{session-1-work-ended}").Subtract(parse("{session-1-work-started}")).TotalHours) + (parse("{session-2-work-ended}").Subtract(parse("{session-2-work-started}")).TotalHours)}
Total Labor Cost:
Input the hourly rate of what you are paying and multiply it by your total labor hours field.
{="$" + (30 * {total-labor-hours})}
You can omit the "$" if desired
{=30 * {total-labor-hours}}