Freezing Values

A Lookup always follows its chart. Change the chart, and every record updates. But once a parcel is billed, its price should never move again. Here are three ways to keep a value, and what each one means.

  • Video 8 of 9
  • 5:38
  • Transcript below
On this page
  1. Chapters
  2. Read the docs
  3. Transcript

Chapters

  1. 0:00 Intro
  2. 0:14 The idea
  3. 0:59 Three ways
  4. 1:09 Copy it
  5. 2:06 Freeze the record
  6. 4:13 Save a snapshot
  7. 4:45 Which way
  8. 4:56 Rules

Read the docs

Transcript

Show the full transcript

0:00 Intro

A Lookup always follows its chart. Change the chart, and every record updates. But once a parcel is billed, its price should never move again. Here are three ways to keep a value, and what each one means.

0:14 The idea

At the parcel shop, the price board on the wall says eleven dollars. A customer pays, and gets a receipt for eleven dollars. On Monday the shop puts up a new board, eleven fifty. The board changes, but the receipt in the customer's pocket still says eleven. It was printed when they paid. In your app, a Lookup is the price board. P one thousand two was invoiced at eleven dollars. Raise the up to ten pound row to eleven fifty, and P one thousand two changes too. Now the record says eleven fifty, but the invoice you sent says eleven. So when should a value stop moving? When the invoice has gone out. When a quote is accepted. When a contract locks the rate. And when a month is closed.

0:59 Three ways

There are three ways. Copy one value into a plain field. Freeze the whole record. Or save a snapshot, and let the record keep updating.

1:09 Copy it

The simplest way works in any app. Add a Number field called Billed Charge. Then open the Parcels table's Workflow tab, and create a workflow with the trigger Record Update. Add a condition: Status is Invoiced. On the Yes path, add the action Update Record, and set Billed Charge to this record's Weight Charge. Save. Mark P one thousand two as Invoiced, and Billed Charge gets eleven dollars. Now raise the chart to eleven fifty. Weight Charge follows the chart, but Billed Charge stays at eleven. Put Billed Charge on your invoices.

2:06 Freeze the record

The second way keeps everything at once. Open the Parcels table and go to its Settings. Under Freeze Records, switch Records can be frozen on, and save. Nothing is frozen yet. This only allows it. Now say when to freeze. Open the same workflow. Under Update Record, add the action Freeze / Unfreeze Record. Under What to do, pick Freeze record. The step runs on this workflow's record. Save. To freeze many at once, like a closed month, use the same step in a Schedule or Manual workflow. It runs once for each record. Mark P one thousand two as Invoiced, and a frost settles on the record. Now raise the chart to eleven fifty again. P one thousand three moves to eleven fifty, and P one thousand two stays at eleven. While a record is frozen, its Lookups, Equations and Rollups ignore every change: the chart, the record, the field settings, a recalculation, an import. Here's the catch. Freezing keeps calculated values, not typed ones. Someone edits P one thousand two's weight to twelve pounds. The weight changes, but Weight Charge stays at eleven. Unfrozen, it would be eighteen. Now the record disagrees with itself. So stop people editing frozen records too, for example by hiding the edit button on invoiced parcels. A frozen record looks like any other, so write down when it was frozen. Under the freeze step, add Update Record. Set the Date and Time field Frozen On, to Current Date and Time, and save. Now you can show it on a page, filter by it, and report on it. To let a record update again, use the same action with Unfreeze record. Say P one thousand two is reopened. The workflow unfreezes it, and it recalculates right away. Eleven fifty, not eleven. Unfreezing doesn't bring back the old price. It uses today's chart.

4:13 Save a snapshot

The third way copies the whole record and leaves it live. Add a Long Text field called Billing Snapshot. In an Update Record step, add Billing Snapshot, open Source Record, and under Data, pick Entire Record, J S O N. Save. Invoice the parcel and open it. Billing Snapshot holds every field by name: the parcel, the service, the weight, and Weight Charge, eleven, as it was then. The record keeps following the chart. The snapshot is for reading and keeping, not for calculating with.

4:45 Which way

So which one? One number, like the billed amount: copy it. Every calculated value on the record: freeze it. Proof of what it looked like, while it keeps updating: save a snapshot.

4:56 Rules

Four rules to keep track of. Freezing keeps calculated values. Typed fields can still be edited, so lock editing too. Unfreezing calculates with today's chart. Switching Records can be frozen off doesn't unfreeze anything. So unfreeze first, then switch it off. And that table's Equations can't use Calculate in Real Time. So that's freezing. A Lookup follows the chart. When a number is final, copy it, freeze the record, or snapshot it. A frozen record keeps its values until you unfreeze it. Next up: choosing between a Lookup, a connection, a Rollup and an Equation.

Also on Vimeo · the whole series on Vimeo