Calculated tests
A calculated test is a quality control plan line whose answer is computed automatically from other numeric answers rather than entered manually. When a user enters or updates an input value during a quality check, all dependent calculated lines recalculate immediately.
Setting up a calculated test
Calculated tests are configured directly on the plan lines. Two fields work together across lines to define what gets calculated and what feeds into it:
- Is Calculated Formula — enables calculated mode on a line. The question assigned to that line must be of type Integer or Decimal. When selected, the Formula field becomes editable and Formula Symbol is locked.
- Formula Symbol — assigned to input lines (non-calculated lines) so they can be referenced in formulas. The value must be unique within the plan. When a question has a Formula Symbol set on the Quality control questions page, it is pre-filled when the question is added to a plan line and can be changed on the line if needed.
- Formula — the expression entered on a calculated line. References input lines by enclosing their Formula Symbol in square brackets.
Formula syntax
Formulas reference other lines by their Formula Symbol wrapped in square brackets. At least one parameter reference is required — a formula consisting of only a constant is not valid.
For example, ([A] * [B]) / 100 multiplies the values referenced by symbols A and B and divides the result by 100.
Supported operators
| Operator | Symbol |
|---|---|
| Addition | + |
| Subtraction | - |
| Multiplication | * |
| Division | / |
| Exponentiation | ^ |
| Grouping | ( ) |
Validation
The formula is validated when saved. The system checks that:
- All referenced symbols exist as plan lines on the same plan.
- All referenced questions are of type Integer or Decimal — referencing Text, DateTime, Option, Photo, or Lot Attribute questions is not allowed.
- The formula contains at least one parameter reference.
- The expression syntax is valid.
If any validation fails, saving is blocked and an error is displayed identifying the specific problem.
Calculation behavior
Calculated lines recalculate automatically when any input answer they depend on changes during a quality check.
How input values are resolved depends on the Frequency Type of both the formula line and the input line:
- If the formula line is Per Sample, only data from the current sample is used for input lines that are also Per Sample. Per Test input lines always contribute a single resolved value.
- If the formula line is Per Test, each input parameter is resolved using that input line's Calculation Method (Average, First, Last, Highest, Lowest) across all samples.
If input values are missing or incomplete, the calculated result is left blank until all required inputs are available.
Rounding
Calculated results are rounded according to the Formula Rounding Precision field. The system applies precision in the following order:
- The Formula Rounding Precision set on the question assigned to the calculated line — see Quality control questions.
- If no question-level precision is set, the global Formula Rounding Precision from the Quality Control Setup page is used.
- If neither is set, no rounding is applied.
Process yield calculation
For example, the following plan calculates process yield from three measured weights. The first three lines are standard input questions; the fourth is the calculated result.
| Sequence | Question | Formula Symbol | Is Calculated Formula | Formula |
|---|---|---|---|---|
| 10 | Gross Input Weight (kg) | GIW | No | |
| 20 | Tare Weight (kg) | TW | No | |
| 30 | Net Output Weight (kg) | NOW | No | |
| 40 | Process Yield (%) | Yes | [NOW] / ([GIW] - [TW]) * 100 |
When the user enters values for lines 10, 20, and 30 during a quality check, line 40 recalculates automatically. For example, a gross input of 500 kg, tare of 50 kg, and net output of 418 kg produces a yield of 92.89% (assuming rounding precision of 0.01).
Per sample vs per test calculation
For example, the following plan demonstrates how the same formula produces different results depending on the Frequency Type of the calculated line. The plan checks fill weight across three samples, with tare weight measured once for the whole check and gross weight measured individually per sample.
Plan setup (3 required samples):
| Sequence | Question | Formula Symbol | Frequency Type | Calculation Method | Is Calculated Formula | Formula |
|---|---|---|---|---|---|---|
| 10 | Gross Weight (g) | GW | Per Sample | Average | No | |
| 20 | Tare Weight (g) | TW | Per Test | — | No | |
| 30 | Net Fill Weight — per sample (g) | Per Sample | — | Yes | [GW] - [TW] | |
| 40 | Net Fill Weight — average (g) | Per Test | — | Yes | [GW] - [TW] |
Sample data entered during the quality check:
| Sample 1 | Sample 2 | Sample 3 | |
|---|---|---|---|
| Gross Weight (GW) | 525 g | 518 g | 531 g |
| Tare Weight (TW) | 25 g | (Per Test — same value used for all) |
Line 30 — Per Sample calculated: The formula runs independently for each sample using that sample's own GW value and the single TW value.
| Sample 1 | Sample 2 | Sample 3 | |
|---|---|---|---|
| Net Fill Weight | 500 g | 493 g | 506 g |
Line 40 — Per Test calculated: The formula runs once for the entire check. Because GW is a Per Sample input, the system resolves it using its Calculation Method (Average): (525 + 518 + 531) / 3 = 524.67 g. TW is Per Test and contributes its single value directly.
Result: 524.67 − 25 = 499.67 g
This means line 30 gives visibility into individual sample variation, while line 40 gives a single representative value for the whole check — both derived from the same formula.