In this video
- The expression line: the live answer, an unknown name, a syntax error
- Functions: min, max, round, floor, ceil, abs, sqrt, pow, clamp and if
- Why the order of actions matters
- Look Up: tiers as ranges, inclusive ends, open ends, first match wins, the fallback
- Formats: int, 1, 2, money, pct and compact
- Three mistakes to avoid
About this video
A calculator ad turns what the viewer chooses into a number they care about - a price, a saving, a monthly payment. This tutorial builds one from scratch in the Playable Ads Maker, so its events are editable on every plan: a Compute action for each formula, a Look Up action that maps ranges to answers, and format specs that print whole numbers, money, percentages and compact figures. It picks up where the Input Controls tutorial left off.
Playable Ads Maker - build playable ads and end cards, export to 13 ad networks.
Transcript
Tap a level of cover, and the premium re-prices itself. Two lookups and one formula are doing that, and there's no code anywhere.
In the next few minutes you'll build the same kind of calculator from scratch: formulas with functions, a lookup table, and numbers that print the way people read them.
The Input Controls video already typed one formula - a price - on a slider's Value Changed. This one picks up where that stopped. The slider here is bound to bill, and nothing happens when it moves yet.
Read the full transcriptShow less
Select the slider, open Events, Value Changed, add an action, and pick Compute. The result goes into savings.
Now watch the line underneath while I type. A name that isn't a variable is flagged straight away - it would quietly read as zero.
Leave a bracket open, and it tells you that too.
Close it, and the panel works it out with the starting values: 504.
Under Operators and functions is everything a formula can use: min, max, round, floor, ceil, abs, square root, power, clamp, and if.
payback = round(6000 / max({savings}, 1), 1)
Order matters. Payback reads savings, so it sits underneath it: the actions run from the top down.
Some answers aren't a formula at all - they're a table. Add a Look Up, write into kit, and look up the bill.
Each tier is a range and a result. Forty to ninety-nine is the starter kit. A hundred to a hundred and ninety-nine, the home kit. Two hundred and up - leave the top blank - the whole-home kit.
Both ends are inclusive, a blank end is open, and if two ranges overlap, the first one wins. The last box is the fallback, for anything no tier catches.
Last, how it prints: {savings|money} → 504.00 · {savings|int} → 504
int · 1 · 2 · money · pct · compact
Press Play and drag the bill up.
Savings, the kit and the payback all follow the slider - and at two hundred, the kit jumps to whole-home.
Three mistakes to avoid. One: a typo in a name. It reads as zero, so the formula still works - it's just wrong. Watch for that amber line.
Two: gaps between tiers. 99.5 is in neither 40–99 nor 100–199 — it falls to the fallback.
Three: pct doesn't multiply by a hundred. Store sixty-four, not point six four, or you'll print one percent.
That's calculations and lookups. Next up, the product configurator. See you in the next video!