Calculate work durations

Tasks in Flowfinity are carried out by software robots, and used to automate routine data management activities in your workflow. Like most other features in Flowfinity, tasks are configured without code and do not require programming skills.

These activities are executed automatically once the user submits the form. You can set up tasks that execute operations for new and existing records in other apps, or update data within the current record.

Example

For inspections and audits, the inspector needs to track the total time spent filling out the form for compliance and billing purposes. The total time spent is calculated by taking the time the form is submitted, and subtracting from it the time the form is opened on the device. The resulting total time will then be stored into a separate field, within the same record.

Instructions

  1. Customize the application.
  2. In the Form section, add a new date/time field that is read-only (e.g. Started working at).
  3. Beside "Default value," enter "currentdatetime()" which is a pre-defined function in Flowfinity that captures the current date and time. This field will now capture the exact time the user opens the form, and store it as its default value.
    Flowfinity - Calculate work durations
  4. To make the field read-only, click on the dropdown under the "Editable" column, and select "No."
    Flowfinity - Calculate work durations
  5. Next, add a new field that is also read-only (e.g. Total time filling the form).
  6. From the "Type" dropdown, select Numeric field. This field will store the calculated value done by the task. In the "Default value" of the field, enter "0."
    Flowfinity - Calculate work durations
  7. To make the field read-only, click the checkmark under the "Editable" column, select "No."
    Flowfinity - Calculate work durations
  8. Next, go into the Operations section, and under the Tasks tab, add a new task.
    Flowfinity - Calculate work durations
  9. Give it a name (e.g. Calculate form filling in time), and add a design comment if you wish.
  10. Click on "Add action."
    Flowfinity - Calculate work durations
  11. Give it a name (e.g. Assign total time worked), and design comment. This action will calculate the total amount of time, and save the value into the field "Total time filling the form (mins)" created in step #6.
    Flowfinity - Calculate work durations
  12. Next, click on the Target tab, and select "Record." The "Record" target means that this task will apply updates to the current record that caused the submission.
    Flowfinity - Calculate work durations
  13. Click on the Fields tab, then "Add mapping." Under the Field dropdown, select the field "Total time filling the form." Under the Type dropdown, select "Formula."
    Flowfinity - Calculate work durations
  14. In the Value section, type the following formula:
    Flowfinity - Calculate work durations
  15. Click save.
  16. Then save the task.
    Flowfinity - Calculate work durations
  17. Next, specify when the task gets triggered. Click on the Operations tab.
  18. Edit the operation "Add New Record."
    Flowfinity - Calculate work durations
  19. Near the bottom under the Tasks section, click "Add task."
    Flowfinity - Calculate work durations
  20. Select the task you just created (e.g. Calculate form filling in time), and choose "Reject" from the dropdown. "Reject" means that this task must be completed successfully in order for the submission to be saved in the system, and removed from the device's pending list.
    Flowfinity - Calculate work durations
  21. Save operation, and publish the app.
  22. To see the results, create a new record and click submit. Once you view the record, you will see that the field "Started working on" will have a date/time value and the field "Total time filing in the form (mins)" will have the time in minutes.