NextGen FSM

Understanding the Calculate Node on the Dynamic Form Panel

This document explains the "Calculate" node type, a fundamental component used in dynamic forms to automatically determine and display values. This node enhances efficiency by performing calculations based on user input from other fields, reducing manual effort and improving data accuracy. It is particularly useful for dynamic calculations in forms that require immediate feedback.

What is a Calculate Node?

The Calculate node is a specialized input field within a dynamic form that automatically computes a value based on a predefined formula or expression. Unlike standard input fields where users manually enter data, the Calculate node's value is derived from other data points within the form, such as numerical inputs, dates, or selections. This ensures that calculated results are always up-to-date and consistent with the underlying data.

Key Characteristics

The Calculate node offers the following features:

  • Automatic Calculation: Values are computed automatically based on an assigned expression.

  • Real-time Updates: The calculated value updates dynamically as dependent fields change.

  • Read-Only: The field is read-only, preventing manual user input and ensuring data integrity.

  • Mathematical Operations: Supports various mathematical operations (addition, subtraction, multiplication, division).

  • Logical Operations: Can incorporate logical conditions to determine output.

  • Referencing Other Nodes: Can reference values from other nodes within the same dynamic form.

How Calculate Nodes Work

The core of a Calculate node is its expression, which defines the formula for its computation. This expression typically involves:

  • Operands: These are the values or references to other nodes that will be used in the calculation.

  • Operators: These are the mathematical or logical symbols that define the operation to be performed (e.g., +, -, *, /, >, <, ==).

  • Functions: More complex calculations might leverage built-in functions.

When a user interacts with fields that the Calculate node's expression references, the system re-evaluates the expression and updates the Calculate node's displayed value in real-time.

Display of the Calculate Node

The Calculate node typically appears as a standard input field but is always read-only. This visual cue indicates that the value is derived and not directly editable by the user. On mobile devices, the display adapts to provide a clear, non-editable representation of the calculated result.

On Server-Side Applications

The Calculate node displays the computed value, which updates dynamically based on user input in related fields. The field is greyed out or otherwise visually marked as non-editable.

On Mobile Devices (iPhone and iPad)

The display behavior is consistent on mobile devices, rendering the calculated result in a read-only format.

Dynamic Behavior with Expressions

While the Calculate node itself is defined by an expression, it can also participate in dynamic behaviors driven by other expressions configured on other nodes. For example, its calculated value could be used to:

  • Make another node visible or hidden.

  • Make another node mandatory.

  • Pre-fill another node.

  • Set another node to read-only.