Calculation Support v2.1
Native Form Maker provides a high-performance calculation engine that runs entirely on the client. This guide covers how to build formulas that react instantly to user input.
How it Works
When you mark a field as Calculated Field = Yes, it becomes read-only by default (though you can toggle this). The engine uses a safe JSEP-based evaluator which prevents arbitrary code execution while remaining extremely fast.
Formula Syntax
Use field Keys (the technical name, usually prefixed with fh_) instead of labels. Formulas support standard arithmetic and logic.
fh_quantity * fh_unit_price * (1 - fh_discount_pct / 100)
Native Functions
Beyond standard math, the engine provides built-in functions for common business logic.
Logical Functions
if(condition, trueVal, falseVal): Standard ternary logic.round(val, precision): Clamps a number to specified decimal places.min(a, b, ...)andmax(a, b, ...): Returns the smallest or largest value.
round(..., 2) to avoid floating-point artifacts like 19.999999999.
Repeater Rollups
One of the most powerful features is the ability to aggregate data from repeater rows into the top-level form.
sumRows('repeater_key', 'child_key')countRows('repeater_key')avgRows('repeater_key', 'child_key')
Pro Examples
Guarded Division
Prevents Infinity or NaN results when dividing by potentially zero values.
if(fh_count == 0, 0, fh_total / fh_count)
Dynamic Tax Logic
Calculates tax only if the fh_taxable toggle is active.
if(fh_taxable, fh_subtotal * 0.0825, 0)