Skip to content
flowon.com

Logic Composer

Formula

Calculate one value, or one list, from a block's inputs and data with a single expression.

A formula is the simplest logic block: one expression that turns inputs and data into one result. Despite the name it is not limited to arithmetic. A formula can build a text, work out a date, pick a value with If Condition or Switch, or filter a list, as long as the answer is a single value or a single list.

Use a formula when the same calculation is needed in more than one place, such as a quote total, an SLA due date or a customer’s display name, so it is defined once and tested once.

  1. Create a logic block and choose the Formula card. See Create a logic block.
  2. Add inputs on the Input tab, and on the Data tab add any rows or queries the formula needs.
  3. On the Formula tab, Choose what it returns: pick the result type in the Type field above the expression. Turn on List of values to return a list.
  4. Write the formula: select Write formula and build the expression in the expression editor. It must result in the type you chose.
  5. Save, then select Run to test it.
Setting What it does Notes
Type The type of the result. Changing it later asks “Change the type?” and clears the formula, so you build it again.
List of values Returns a list instead of one value. Not available when the block is exposed as a Dataverse action.
Expression The calculation. One expression, built in the expression editor.
  • The block has one output, named result. Callers that use the block in an expression pick result; flows read it from the step that called the block.
  • The expression is evaluated each time the block runs, after the precondition and the Data tab.
  • Empty inputs follow the expression rules: an empty number counts as 0 in arithmetic and comparisons, and an empty Yes/No counts as No in And and Or. Check optional inputs with Null or First Non-Empty. See Empty values.
  • Dividing two whole numbers gives a whole number, so 7 / 2 is 3. Make one side a Decimal Number (for example with To Decimal) to keep the fraction. Dividing by zero fails the run.

Inputs: Quantity (Whole Number), UnitPrice (Currency), DiscountPercent (Decimal Number) Type: Currency

Quantity * UnitPrice - Quantity * UnitPrice * DiscountPercent / 100

Inputs: CreatedOn (Date and Time), Priority (Choice, Case Priority) Type: Date and Time

AddBusinessDays(CreatedOn, Switch(Priority; High => 1; Normal => 3; else 5))

Inputs: AnnualRevenue (Currency) Type: Text

If(AnnualRevenue ≥ 1000000, "Enterprise", If(AnnualRevenue ≥ 100000, "Mid-market", "SMB"))

Inputs: Contacts (Row: Contact with its email column, List of values on) Type: Row (Contact), with List of values on.

Filter(Contacts, c, Not Null Or Empty String(c.emailaddress1))

The block returns a list of contacts that a flow can loop over.