Perform calculations on-demand

In Flowfinity, formula calculations can either be

On-demand calculations are accomplished through calculated defaults. With calculated defaults, you also have the option to make the calculated field editable by the user.

To set up a calculated default value, simply click "Abc" on the right of the default value of a field, select “calculated value” from the menu, and type in the formula.

Flowfinity - Perform calculations on-demand

Example 1

A common use case for calculated defaults is capturing each date a record was modified, for records that are modified several times.

In this inspection application, a single record is created for each site, and the different inspections for that site that occur over a period of time are recorded into a nested field.

Each time an inspection is performed, the inspector adds a new item in the nested field with the inspection results. The inspection date and time are automatically calculated when the item is added.

Flowfinity - Perform calculations on-demand

Instructions

  1. Customize your application.
  2. In the Form section, add a Nested field.
    Flowfinity - Perform calculations on-demand
  3. Click the button "Customize nested form."
    Flowfinity - Perform calculations on-demand
  4. Add a date field to the nested form.
    Flowfinity - Perform calculations on-demand
  5. In the "Default value" of the field, click "Abc" on the right and select "Calculated value." Ensure that this is done within the "Default value" and not the field "Type."
    Flowfinity - Perform calculations on-demand
  6. Type in the formula. In this example, the formula currentdatetime() will capture the date and time a new item is added to the nested list.
    Flowfinity - Perform calculations on-demand
  7. In the Layout section of the same field, click the checkmark in the "Editable" column and change the answer to "No." This will ensure that users can't change the inspection date or time once it's captured.
    Flowfinity - Perform calculations on-demand
  8. Save the form, and publish the application.
    Flowfinity - Perform calculations on-demand

Example 2

Another use case involves resetting a field to its calculated default value each time a certain layout is used. This lets you control specifically when the default value should be calculated, during specific operations or steps in your workflows.

In this example, an inspection report will be sent to a customer several times over a period of time, when an inspection update is made. A calculated default will be used to capture the date and time the report was last sent to the customer.

  1. Customize the application
  2. In the Form section, click on the "Layouts" link and then the Add Layout button to add a new layout.
    Flowfinity - Perform calculations on-demand
  3. Specify the name of the new layout, such as "Send to Customer."
    Flowfinity - Perform calculations on-demand
  4. If needed, add a new Page to organize the fields that will be used when sending reports to the customers. You can control the settings (included, visible, editable, mandatory), for individual fields or entire pages, for each layout.
    Flowfinity - Perform calculations on-demand
  5. Add the field "Last Sent to Customer Date." Click on the "Abc" next to the default value, and type the formula currentdatetime().
    Flowfinity - Perform calculations on-demand
  6. Under Layouts, click on the menu in the "Included" column, and select "Yes, reset." This setting means that each time this layout is used, the field will be recalculated to its default value.
    Flowfinity - Perform calculations on-demand
  7. Next, go into the Operations section and create an operation that uses this layout, such as an Edit operation called "Send Update to Customer." In "Display record in this layout", select the layout you created "Send to Customer."
    Flowfinity - Perform calculations on-demand
  8. Publish the application.
    Flowfinity - Perform calculations on-demand