Skip to content

Calculated fields

A Calculated field is a tile in a capture mask that computes a number from the other fields of the same mask — while somebody is typing, before anything is saved. That is what it is called in the mask setup, and the line under it says what it is: A number computed from the fields of this mask. It is shown, never captured.

So it is not a field of the record type. It has no column, no data type and no stored value. What is stored is always the input quantities; the figure is derived from them — in the mask at once, on the dashboard later from the stored rows. That is why both show the same number, and why correcting a row later corrects the figure with it.

Label Meaning
Formula “Field names of this mask, joined by + - * / and brackets.” Example: (ActualRuntime - Downtime) / ActualRuntime
Explanation the line under the number — what it is made of
Format Number or Percent; percent multiplies by 100 and appends the sign
Decimals how many places are shown
Unit free text for the Number format, such as pcs/h, min, ppm
Warning threshold, Critical threshold colour the tile; give them in the displayed unit - 90 for “below 90 %”, not 0.9
Good direction higher is better or lower is better

Without thresholds the tile gets no colour. An invented green would be worse than no traffic light, because somebody believes it. Where there is colour, a distinct icon sits beside it.

Numbers, field names, + - * /, brackets and five functions: min, max, abs, round, coalesce.

Nothing more — no comparisons, no conditions, no text. Anything that has to make a decision belongs in a query tag or in a trigger, where it can be read and reviewed.

A formula may address three kinds of name:

  • the fields of this mask, by the name of the data field they are bound to,
  • the lines of a repeating group, as one sum per column under that column’s name — a mask with a defect list then shows “Total defects: 8” while the third line is still being typed,
  • the columns of a selected master-data row, addressed as Station.Capacity — the station brings its target values along, and the tile computes with them before anything is saved.

Never a query over stored records. A mask has to work on a device that has just lost its connection; a figure that needs the network is a figure that is missing at the machine. Aggregation over many records is the dashboard’s job.

A missing value gives an empty result. An unknown or blank field yields nothing, and every calculation with it yields nothing. A half-filled mask shows a dash, never a number computed from the fields that happen to be filled already.

Division by zero also gives a dash. That is the ordinary state before the first entry of a shift, not an error.

A formula error is not a missing value. It is reported straight away in the setup dialog: The formula cannot be read: — with the place. The dialog also shows which names the formula uses, and warns when no field of this mask carries these names. A typo should show up in the dialog, not on the shop floor as an empty tile.

coalesce(a, b) is the one function allowed to catch a missing value: “this, or else that”. It takes exactly two values — a chain of five would be a decision tree, and there are none here.