Workflow action

Math & statistics

ut_math

Safe formulas with variables, exact rounding, statistics and percentiles, compound interest, loan schedules and unit conversion in one workflow step.

Officialv1.0.07 functions Pure computation

About

What it does

Math & statistics gives workflows the numeric operations that otherwise take a chain of Calculate Value nodes or a spreadsheet. Evaluate a formula such as (price * qty) * (1 + tax_rate) against an object of variables with a real parser (never eval), round with half-up, banker's, floor or ceiling rules that are decimal-exact, and summarise a list of numbers or a field of a list of rows: count, sum, mean, median, mode, variance, standard deviation and percentiles.

The finance operations return what approvals and customer letters need. Loan schedule computes the monthly payment, each period's interest and principal, totals and the payoff date, with money in cents so the last payment brings the balance to exactly zero; Compound interest grows savings with regular contributions and returns a year-by-year table. Convert units covers length, mass, volume, temperature, area, speed, data size and time. Everything runs in the sandbox with no network, data or secret access.

Good for

  • Show a loan or lease repayment schedule in a quote or approval task
  • Summarise order values or response times (mean, median, 90th percentile) in a scheduled report
  • Compute totals with tax and discounts from form fields using one readable formula

After installing

  1. Install the package: the action appears in Extensibility → Workflow actions and in the workflow designer's palette under Custom actions.
  2. Drag Math & statistics onto a workflow, choose the function (Evaluate formula, Loan schedule, …) and map its inputs from variables or form fields.
  3. Use the outputs from the data picker, e.g. {{loan_payment}} or loop over {{loan_schedule}} rows; each output is typed (number, date, list of objects).
  4. Try the included "Loan repayment schedule (sample)" workflow: run it from the API or its start form with no input to see a 60-month schedule.

Examples

Real inputs, real outputs

Each example ran in the sandbox when this gallery was built; the outputs are exactly what the step returns.

Order total with tax and discount evaluate

Variables come from an object; the result is rounded to 2 decimals.

Inputs

{
  "expression": "(price * qty) * (1 + tax_rate) - discount",
  "variables": {
    "price": 19.99,
    "qty": 3,
    "tax_rate": 0.15,
    "discount": 5
  },
  "decimals": 2
}

Outputs

{
  "result": 63.97
}

Five-year car loan loan_schedule

Inputs

{
  "principal": 25000,
  "annual_rate": 7.9,
  "term_months": 60,
  "start_date": "2026-12-01"
}

Outputs

{
  "payment": 505.71,
  "total_interest": 5342.93,
  "total_paid": 30342.93,
  "number_of_payments": 60,
  "payoff_date": "2031-11-01",
  "schedule": [
    {
      "period": 1,
      "date": "2026-12-01",
      "payment": 505.71,
      "principal": 341.13,
      "interest": 164.58,
      "balance": 24658.87
    },
    {
      "period": 2,
      "date": "2027-01-01",
      "payment": 505.71,
      "principal": 343.37,
      "interest": 162.34,
      "balance": 24315.5
    },
    {
      "period": 3,
      "date": "2027-02-01",
      "payment": 505.71,
      "principal": 345.63,
      "interest": 160.08,
      "balance": 23969.87
    },
    {
      "period": 4,
      "date": "2027-03-01",
      "payment": 505.71,
      "principal": 347.91,
      "interest": 157.8,
      "balance": 23621.96
    },
    {
      "period": 5,
      "date": "2027-04-01",
      "payment": 505.71,
      "principal": 350.2,
      "interest": 155.51,
      "balance": 23271.76
    },
    {
      "period": 6,
      "date": "2027-05-01",
      "payment": 505.71,
      "principal": 352.5,
      "interest": 153.21,
      "balance": 22919.26
    },
    {
      "period": 7,
      "date": "2027-06-01",
      "payment": 505.71,
      "principal": 354.82,
      "interest": 150.89,
      "balance": 22564.44
    },
    {
      "period": 8,
      "date": "2027-07-01",
      "payment": 505.71,
      "principal": 357.16,
      "interest": 148.55,
      "balance": 22207.28
    },
    {
      "period": 9,
      "date": "2027-08-01",
      "payment": 505.71,
      "principal": 359.51,
      "interest": 146.2,
      "balance": 21847.77
    },
    {
      "period": 10,
      "date": "2027-09-01",
      "payment": 505.71,
      "principal": 361.88,
      "interest": 143.83,
      "balance": 21485.89
    },
    {
     
…

Summary of response times stats

Inputs

{
  "values": [
    {
      "minutes": 12
    },
    {
      "minutes": 15
    },
    {
      "minutes": 15
    },
    {
      "minutes": 18
    },
    {
      "minutes": 21
    },
    {
      "minutes": 30
    }
  ],
  "field": "minutes"
}

Outputs

{
  "count": 6,
  "sum": 111,
  "mean": 18.5,
  "min": 12,
  "max": 30,
  "median": 16.5,
  "mode": 15,
  "variance": 41.1,
  "stddev": 6.41092816992984,
  "range": 18
}

Banker's rounding round

Half even rounds 2.345 to 2.34 and 2.355 to 2.36.

Inputs

{
  "value": 2.345,
  "decimals": 2,
  "mode": "half_even"
}

Outputs

{
  "result": 2.34
}

Marathon in kilometres convert_units

Inputs

{
  "value": 26.2,
  "from": "mi",
  "to": "km"
}

Outputs

{
  "result": 42.1648128,
  "category": "length",
  "from_unit": "mi",
  "to_unit": "km"
}

Reference

Functions, inputs and outputs

The designer generates each function's input panel from these declarations; outputs appear in the data picker with their types.

Evaluate formula evaluate

Evaluate an arithmetic formula with + - * / % ^ and parentheses, variables from an object and the functions abs, round, floor, ceil, sqrt, min, max, pow, log, ln, exp, sin, cos and tan (constants pi and e). Never runs code.

Inputs

  • expression string · required — For example (price * qty) * (1 + tax_rate) - discount. Variable names may be dotted paths into Variables (order.total). ^ is power, % is remainder; log(x) is base 10, log(x, b) base b, ln(x) natural.
  • variables object — The values the formula uses, as an object: { "price": 19.99, "qty": 3 }. Numeric text is accepted.
  • decimals integer — Optional: round the result to this many decimal places (half up). Leave empty for the full result.

Outputs

  • result number — The value of the formula.

Round round

Round a number to a number of decimal places with an explicit rounding mode. Decimal-exact: 1.005 rounds to 1.01.

Inputs

  • value number · required — The number to round.
  • decimals integer — Decimal places (0 for whole numbers; negative rounds to tens, hundreds…).
  • mode choice · half_up / half_even / up / down / floor / ceil — How to round a value that sits between two results.

Outputs

  • result number — The rounded number.

Statistics stats

Descriptive statistics for a list of numbers (or a field of a list of objects): count, sum, mean, min, max, median, mode, variance, standard deviation and range.

Inputs

  • values list · required — The numbers: a list of numbers (or numeric text), or a list of objects with Field naming the number. Blank entries are skipped.
  • field string — When Values is a list of objects: the property holding the number (dotted paths such as amount.total work).
  • variance_type choice · sample / population — Sample (n - 1, for a sample of a larger population) or population (n, for the whole set).

Outputs

  • count integer — How many numbers there are (blank entries are skipped).
  • sum number
  • mean number — The average (empty when there are no numbers).
  • min number
  • max number
  • median number — The middle value (the average of the two middle values for an even count).
  • mode number — The most frequent value (the smallest if several tie); empty when no value repeats.
  • variance number — Sample variance needs at least 2 numbers.
  • stddev number
  • range number — Maximum minus minimum.

Percentile percentile

The p-th percentile of a list of numbers, with linear interpolation between the closest ranks (the same as Excel PERCENTILE.INC).

Inputs

  • values list · required — The numbers: a list of numbers (or numeric text), or a list of objects with Field naming the number. Blank entries are skipped.
  • field string — When Values is a list of objects: the property holding the number (dotted paths such as amount.total work).
  • p number · required — From 0 to 100: 50 is the median, 90 the 90th percentile.

Outputs

  • value number — The percentile.
  • count integer — How many numbers were used.

Compound interest compound_interest

Grow a starting amount with compound interest and optional regular contributions; returns the future value and a year-by-year schedule.

Inputs

  • principal number · required — The amount invested at the start.
  • annual_rate number · required — Nominal annual interest rate in percent, e.g. 5 for 5%.
  • years integer · required — How many years (1 to 100).
  • compounds_per_year integer — 1 yearly, 4 quarterly, 12 monthly, 52 weekly, 365 daily.
  • contribution number — Optional amount added every compounding period (e.g. monthly when compounding monthly).
  • contribution_timing choice · end / start — Whether contributions are added at the start or the end of each period.

Outputs

  • future_value number — The balance at the end, rounded to 2 decimals.
  • total_contributions number — The starting amount plus every contribution.
  • interest_earned number — Future value minus total contributions.
  • schedule list of objects — One row per year.each: year (integer), contributions (number), interest (number), balance (number)

Loan schedule loan_schedule

Monthly amortisation schedule for a fixed-rate loan: the payment (P·r / (1 − (1 + r)^−n)), each period's interest and principal, the balance, totals and the payoff date. Extra payments shorten the loan.

Inputs

  • principal number · required — The amount borrowed.
  • annual_rate number · required — Nominal annual interest rate in percent (0 for an interest-free loan).
  • term_months integer · required — Number of monthly payments (1 to 600), e.g. 360 for 30 years.
  • start_date date — Optional: the date of the first payment; later payments fall on the same day of each month (the last day in shorter months).
  • extra_payment number — Optional extra principal paid with every payment.

Outputs

  • payment number — The regular payment (the last one may be smaller).
  • total_interest number
  • total_paid number — Principal plus interest.
  • number_of_payments integer — Fewer than the term when extra payments are made.
  • payoff_date date — The date of the last payment (empty without a first payment date).
  • schedule list of objects — One row per payment.each: period (integer), date (date), payment (number), principal (number), interest (number), balance (number)

Convert units convert_units

Convert a value between units of length, mass, volume, temperature, area, speed, data size and time.

Inputs

  • value number · required — The amount to convert.
  • from string · required — Symbol or name: mm cm m km in ft yd mi nmi · mg g kg t oz lb st · ml l m3 tsp tbsp floz cup pt qt gal gal_uk · C F K · m2 km2 ha ac ft2 · m/s km/h mph kn · bit B kB MB GB TB KiB MiB GiB Mb Gb · ms s min h d wk mo yr.
  • to string · required — A unit of the same kind as From unit.

Outputs

  • result number — The converted value (12 significant digits).
  • category string — length, mass, volume, temperature, area, speed, data or time.
  • from_unit string
  • to_unit string

Network

None. The action cannot make requests.

Data and files

None. It only sees its inputs.

Secrets

None.

Install

Install it in your workspace

Works on UserTasks cloud and any self-hosted instance. The action lands in Extensibility → Workflow actions, enabled, with its sample workflow.

In the app

  1. Open Extensibility → Workflow actions → Browse gallery and choose Install on Math & statistics. Or download workflow-action-math-statistics-1.0.0.utpkg and drag it onto Automations → Packages.
  2. The wizard verifies the checksum, every file hash and the signature, and shows what it adds.
  3. In the workflow designer, drag Math & statistics from Custom actions, pick a function and fill its inputs. Save & Test shows the typed outputs.

With the CLI

shell
curl -fLO https://usertasks.com/gallery/workflow-action-math-statistics-1.0.0.utpkg
usertasks packages install workflow-action-math-statistics-1.0.0.utpkg
usertasks activities test ut_math -f '{"operation":"evaluate"}'

Verify the download

File SHA-256
c023f7679ada75ed362df77c743c6fe2fe7ea652b64f0a6187566aea1267dd81
Package checksum (what is signed)
sha256:9cd7fb1e83d7c896729926a168961db5e72e5ae0dc01fcabde7073459c058a3a
Module SHA-256
5cb2c6c7a87f89a49f3c787008d7ca67ec8657fa94656f96857e0de7c6487a64
Signer
UserTasks Gallery · 49:f3:04:90:47:02:4d:07:28:61:3d:dc:bb:aa:db:11

More workflow actions

All actions