Article

    Calculated fields | Forms Help

    3 min read
    Last updated 4 days ago

    Calculated fields let you define a formula that computes a value from other field answers in the same form. The result is shown to the respondent as a read-only value and is written to Attio on submission.

    Calculated fields are a Pro plan and above feature.

    What they are for

    Common uses include:

    • Calculating a total price from quantity and unit cost fields
    • Computing a score or rating from multiple numeric inputs
    • Deriving a value (e.g. a discount amount) from a conditional expression
    • Concatenating name parts or building a reference string

    Referencing other fields

    Reference other fields in your formula by their Attio attribute slug, wrapped in double curly braces:

    {{quantity}} * {{unit_price}}
    

    The autocomplete in the formula editor suggests available field slugs as you type {{.

    Supported functions

    Arithmetic operators

    OperatorDescription
    +Addition
    -Subtraction
    *Multiplication
    /Division

    Numeric functions

    FunctionDescription
    sum(a, b, ...)Sum of all arguments
    avg(a, b, ...)Average of all arguments
    min(a, b, ...)Smallest value
    max(a, b, ...)Largest value
    round(n, decimals)Round n to decimals decimal places
    abs(n)Absolute value of n

    Conditional function

    if(condition, then, else)
    

    Returns then if condition is truthy, otherwise returns else. Conditions support ==, !=, >, <, >=, <=.

    Example:

    if({{plan}} == "enterprise", {{seats}} * 99, {{seats}} * 49)
    

    String functions

    FunctionDescription
    concat(a, b, ...)Concatenate all arguments into a single string
    upper(s)Convert string to upper case
    lower(s)Convert string to lower case

    Regex function

    regex(value, pattern)
    

    Returns true if value matches the regular expression pattern, false otherwise. Useful inside if() conditions.

    Display

    Calculated fields are shown to the respondent as a read-only input. They can see the computed result but cannot edit it. The field updates in real time as the respondent fills in the source fields.

    Server-side recomputation

    For security, calculated field values are recomputed on the server when the form is submitted. The client-displayed value is for UX only; the server always calculates the final value independently. This means calculated field values cannot be tampered with by a respondent or a browser extension.