Workflow StepsCompute Step

Compute Step

Work out a number from your Member's answers, such as a score, a budget or a price, and show it the way your Members expect to read it.

Turn Answers Into a Number

A Compute Step works out a value with a formula, such as a readiness score, a monthly budget or a price estimate. It uses your Member's answers and the results of earlier Steps, and it runs instantly without AI. Use the result to branch with a Condition Step, to give an Agent step a number to work from, or to show your Member, formatted as money or a percentage.

Add a Compute Step

Spark doesn't add Compute Steps, so you add them in the workflow editor.

If Spark built this workflow, a later Spark change replaces every Step, including a Compute Step you add here. Add it once you're done asking Spark for changes, and add it again after any later Spark change. See What a Spark Change Replaces.

Add the Step

Click Compute in the Logic group of the Steps list. Put it after the Steps whose answers or results it uses.

Name it for its result

Set Step Name to what the Step works out, such as Monthly Budget. Later Steps use the result under that name.

Describe the calculation

In Describe the Calculation, say what to work out in plain words, for example: "Monthly budget is the yearly revenue goal divided by 12, times the share they want to spend on marketing."

Get the formula

Click Generate Formula to have AI draft the Formula from your description, or write it yourself. See Write the Formula.

Format the result if your Members will see it

Check Format the Result to show it as money, a percentage or a rounded number. See Format the Result.

Test it

Click Preview and run the workflow with answers you've worked out by hand, then check that the result matches. See Testing and Publishing a Workflow.

Write the Formula

Click Insert Variable to add your Member's answer from an earlier Step under Input Fields, or an earlier Step's result under Step Outputs, then write the math around it. User Knowledge isn't available here. See Variables.

In these examples, a name in curly brackets, such as {{revenue_goal}}, stands for a variable you inserted:

FormulaWorks out
{{revenue_goal}} / 12 * {{marketing_share}} / 100A monthly marketing budget.
{{hours_per_week}} * {{hourly_rate}} * 4A monthly income estimate.
round(({{clarity}} + {{confidence}} + {{momentum}}) / 3, 1)The average of three ratings, to one decimal place.
max({{estimate}}, 500)The estimate, or 500 if it's lower.

You can use:

  • Math: +, -, *, /, % and ^ for powers.
  • Functions such as round(x, decimals), min, max and sqrt.
  • Choices: condition ? a : b, such as {{employees}} > 10 ? 2000 : 500.

If ThoughtFlow can't read the formula, a message appears in red under it a moment after you stop typing.

Generate Formula

Generate Formula sends AI your description and the names of the variables this Step can use, then puts its formula in Formula, in place of what's there. Generate Formula doesn't use Credits. It needs a description, and at least one earlier Step with answers or a result. Otherwise it says "Describe the calculation first." or "No input variables available. Connect upstream steps before this one."

Read the formula it writes before you test. AI can use functions that the Compute Step doesn't run, such as if(), lower(), upper() or length(), or ** for powers. Replace them with the forms above.

Answers the Formula Can Use

  • Number and Slider answers work as numbers.
  • Text that's a number, such as "250", works as a number.
  • An empty answer counts as 0.
  • Other text, such as a checkbox's "Yes" or "No", can't be used in math. The Step fails. To turn an answer into a number, branch on it with a Condition Step instead, or ask with a Number field.

Dividing by zero gives "Infinity". A result with more than 6 decimal places is rounded to 6.

If the formula fails when the workflow runs, the Step has no result and the run goes on. Steps that use its result get nothing from it. Test with Preview before you publish.

Format the Result

The result is a plain number, such as 49900 or 12.5. Check Format the Result to also make a version your Members can read:

SettingChoices
SymbolAny text, such as $ or %. Leave it blank for none.
Symbol PositionPrefix ($100) or Suffix (100 %).
Decimal PlacesFrom 0 to 6. Starts at 2.
Thousands SeparatorComma (1,000), Period (1.000), Space (1 000) or None (1000).
Decimal SeparatorPeriod (1.50) or Comma (1,50). With a comma or period thousands separator, it's set to the other mark.

The Preview line shows how 1234.5 looks with your choices.

Use the Result in Later Steps

A Compute Step gives later Steps two variables, both under Step Outputs in Insert Variable:

VariableHoldsUse it in
Monthly Budget ({{monthly_budget}})The plain number, such as 4166.67.A Condition Step, another formula, or an Agent step's instructions.
Monthly Budget (Formatted) ({{monthly_budget_formatted}})The formatted number, such as $4,166.67. Listed only when Format the Result is checked.Text your Member reads, such as an Info Step, a completion screen or an Asset name.

Use the plain variable in formulas and conditions. The formatted one is text. See Variables.

An Agent step connected straight after the Compute Step receives the plain number automatically. See Agent Step.

Hide from Progress List starts on for a Compute Step. See Step Types.

Tips for Compute Steps

  • Ask for numbers with Number or Slider fields. A typed answer like "about 50k" can't be used in math. See Input Field Types.
  • Work out the answer by hand first. Choose test answers, do the math yourself, then check that Preview gives the same result.
  • Branch on scores. A Compute Step followed by a Condition Step gives each Member the path that fits their score. See Condition Step.