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.
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
- Install the package: the action appears in Extensibility → Workflow actions and in the workflow designer's palette under Custom actions.
- Drag Math & statistics onto a workflow, choose the function (Evaluate formula, Loan schedule, …) and map its inputs from variables or form fields.
- 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).
- 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
expressionstring · 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.variablesobject — The values the formula uses, as an object: { "price": 19.99, "qty": 3 }. Numeric text is accepted.decimalsinteger — Optional: round the result to this many decimal places (half up). Leave empty for the full result.
Outputs
resultnumber — 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
valuenumber · required — The number to round.decimalsinteger — Decimal places (0 for whole numbers; negative rounds to tens, hundreds…).modechoice · half_up / half_even / up / down / floor / ceil — How to round a value that sits between two results.
Outputs
resultnumber — 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
valueslist · required — The numbers: a list of numbers (or numeric text), or a list of objects with Field naming the number. Blank entries are skipped.fieldstring — When Values is a list of objects: the property holding the number (dotted paths such as amount.total work).variance_typechoice · sample / population — Sample (n - 1, for a sample of a larger population) or population (n, for the whole set).
Outputs
countinteger — How many numbers there are (blank entries are skipped).sumnumbermeannumber — The average (empty when there are no numbers).minnumbermaxnumbermediannumber — The middle value (the average of the two middle values for an even count).modenumber — The most frequent value (the smallest if several tie); empty when no value repeats.variancenumber — Sample variance needs at least 2 numbers.stddevnumberrangenumber — 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
valueslist · required — The numbers: a list of numbers (or numeric text), or a list of objects with Field naming the number. Blank entries are skipped.fieldstring — When Values is a list of objects: the property holding the number (dotted paths such as amount.total work).pnumber · required — From 0 to 100: 50 is the median, 90 the 90th percentile.
Outputs
valuenumber — The percentile.countinteger — 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
principalnumber · required — The amount invested at the start.annual_ratenumber · required — Nominal annual interest rate in percent, e.g. 5 for 5%.yearsinteger · required — How many years (1 to 100).compounds_per_yearinteger — 1 yearly, 4 quarterly, 12 monthly, 52 weekly, 365 daily.contributionnumber — Optional amount added every compounding period (e.g. monthly when compounding monthly).contribution_timingchoice · end / start — Whether contributions are added at the start or the end of each period.
Outputs
future_valuenumber — The balance at the end, rounded to 2 decimals.total_contributionsnumber — The starting amount plus every contribution.interest_earnednumber — Future value minus total contributions.schedulelist 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
principalnumber · required — The amount borrowed.annual_ratenumber · required — Nominal annual interest rate in percent (0 for an interest-free loan).term_monthsinteger · required — Number of monthly payments (1 to 600), e.g. 360 for 30 years.start_datedate — Optional: the date of the first payment; later payments fall on the same day of each month (the last day in shorter months).extra_paymentnumber — Optional extra principal paid with every payment.
Outputs
paymentnumber — The regular payment (the last one may be smaller).total_interestnumbertotal_paidnumber — Principal plus interest.number_of_paymentsinteger — Fewer than the term when extra payments are made.payoff_datedate — The date of the last payment (empty without a first payment date).schedulelist 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
valuenumber · required — The amount to convert.fromstring · 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.tostring · required — A unit of the same kind as From unit.
Outputs
resultnumber — The converted value (12 significant digits).categorystring — length, mass, volume, temperature, area, speed, data or time.from_unitstringto_unitstring
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
- 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.
- The wizard verifies the checksum, every file hash and the signature, and shows what it adds.
- 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
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 actionsCrypto & IDs
ut_crypto
UUID v4/v7 and ULIDs, SHA hashes, HMAC webhook signatures with a stored secret, base64/hex/URL encoding, random and one-time codes, and HS256 JWTs.
UUID · ULID · Hash · HMAC signature · Encode · Decode · +4 more
10 functions Uses secrets
Data transform
ut_data
Select by JSON path, map, filter, sort, group and aggregate, pivot, de-duplicate and join lists of records, and convert CSV to JSON and back.
Select (JSON path) · Map fields · Filter · Sort · Group & aggregate · Pivot · +5 more
11 functions Pure computation
Dates & business calendar
ut_dates
Business days around holidays, SLA due times in working hours across time zones and DST, durations and ages, recurring schedules and fiscal periods.
Add business days · SLA due time · Duration / age · Convert time zone · Next occurrences · Fiscal period
6 functions Pure computation