What its used for

If your field crews need to record total drive time, on-site time, and such, they can enter start times and end times into their XForms field form, and XForms will automatically calculate elapsed time.  It can display elapsed time in seconds, minutes, hours, days, months, or years.   And if you set this up in a table grid, you can even add up all the elapsed times and SUM them on the table footer.

How to set this up

This is done in the Form Template Designer using an expression named timeDiff.   Steps:

  1. Open your form template
  2. Add time fields for start time and end time.  Something like start_time and end_time
  3. Add a calculated field, and in the expression block of the calculated field, enter the timeDiff expression.  Something like timeDiff({start_time}, {end_time}, ‘minutes’)

timeDiff expression settings

Definition:

Calculates the difference between start time value and end time value and returns the number based on requested unit
timeDiff({start-time-field}, {end-time-field}, ‘unit’)

  • start-time-field: Date or Time field ID that contains start time
  • end-time-field: Date or Time field ID that contains end time
  • unit: one of the followings surrender by single quote
    • seconds
    • minutes
    • hours
    • days
    • months
    • years

Example:

timeDiff({start_time}, {end_time}, ‘hours’)

What it looks like in the Designer tool

Here’s what this will look like in the form template Designer. Note that the expression in the example below uses “minutes” as the display units, and then the whole thing is divided by 60.  This could also have been done by just using “hours” as the units (without needing to divide by 60).
 

 

What it looks like on the mobile app

 

 

What you can do with this info when aggregated

 If you set up your form template to SUM the elapsed time columns, you can pass this info to the reporting dashboard aggregation blocks, letting you view the total elapsed time over the selected period of time.  With no more than 2 clicks, you can view the total elapsed time within seconds.  In the xample below notice that the period of time selected was 30 days, and within those 30 days, a total of 181 forms were submitted into XForms, with a total drive time calculated at 408.75 hrs, and on-site time of 258 hours.  Add both of these together and the field crew for this organization recorded 666.75 billable hours over a 1 month period of time.
 
 

 

 

Since its XForms, it can scale

The example above is from one of our customers, whose field crews use XForms to record hazardous and non-hazardous waste information at dozens of locations spread out over an entire state.  Since they started using XForms about 18 months ago, their field crews have submitted over 6,000 forms into the platform for a single client of theirs.

Want to give XForms a try?

Click/tap the button below.