Docs

Logic

Tracing a number

A walkthrough of how to trace any number in Konstrukt back to its origin — from a cell in an app to the value type, the calculation that wrote it, its sources, its history and its import — using the platform's lineage and inspection tools.

Every stored value in Konstrukt records who or what produced it, and every calculation exposes what it reads and writes. You can therefore follow any number upstream to its inputs, or downstream to everything it affects, without having written the logic yourself. This page brings together the tools that make that possible.

  1. Cell in an appInspect cell
  2. Value typelineage panel
  3. Calculationsources, working set, diagnostics
  4. Source value typesrepeat upstream
  5. Import or user entryedited by, edited time

Starting points#

Starting point What it tells you Where
A cell in an app The value, expression, writeback, presentation rules and why it is read-only Inspect cell (Inspektera cell) in the cell context menu, see Using apps
A value-type row Last changed, changed by, and the writing calculation's ID as a link Column chooser in the value-type view: Last changed, Last changed by, Calculation ID (Senast ändrad, Senast ändrad av, Beräknings-id)
A value type Calculations that write to it, calculations that read it, apps that use it, size Details panel on the value type
A calculation Sources with conditions, working set, formula, output, diagnostics, run order, cycle flag The calculation editor, see Calculations
The whole logic Which calculations feed which, in which order Show diagram, see Dependency graph
A dimension Value types that use it, properties and bindings, feeding integrations, SQL view Dimension editor panels, see Data model
A point in time What the number was then from history, point-in-time references, see References and history

Walkthrough#

  1. Inspect the cell. In the app, right-click the cell and choose Inspect cell (Inspektera cell). The panel shows the dataset expression behind the cell, its writeback (if any), the presentation rules that apply, and the reason the cell is read-only if it is. Show all rows (Visa alla rader) shows the underlying rows that make up the cell.
  2. Open the value type. In the admin interface, open the value type and switch on the lineage columns. Rows written by a calculation show its ID as a link. Rows with no calculation ID were entered by a user or imported. Last changed by says who or which integration wrote them.
  3. Follow the calculation. Open the calculation. Its sources show what it reads and under which conditions. The working set shows the joined rows the formula saw, with one value column per source. The output shows the result at the destination's grain. Filter both tables to the combination you are tracing.
  4. Check the transformation. Open Diagnostics to see how Kex resolved joins, includes and aggregation for the query.
  5. Repeat upstream. Each source is a value type. Go back to step 2 for it until you reach user-entered or imported data.
  6. Compare over time. Switch the value-type view to a reference, or query with from history <datetime>, to see what the number was at an earlier moment and when it changed.
  7. Find the import. For imported rows, the value type's or dimension's Integration panel shows the configurations that feed it. The integration Jobs and Logs show when they ran. See Data integration.

Why a cell is read-only#

A cell cannot be edited for one of three reasons. The tooltip and the Inspect panel say which one applies.

Reason Swedish Meaning
Locked values Låsta värden The dataset's locked values cover the cell; it is shown grey
Calculated value Beräknat värde The value is written by a calculation; change its sources instead
No writeback Uttrycket saknar writeback The cell's expression has no writeback rule, so an entry has nowhere to go

Access restrictions can also make a whole dataset or rows read-only. See Security.

Tracing with Kex#

The internal columns make lineage queryable:

Amount.** where Amount.$calcid == null

This lists user-entered and imported rows with their edit time, editor and line state.

sum(Amount) expand Amount.$calcid

This shows how much each calculation contributes to a total. $calcid is empty for rows that no calculation wrote.

Tracing via MCP

  • Use get_calculation_graph with outputEntityIds: ["Amount"] to find the calculations writing a value type.
  • Use referencedEntityIds to find its readers.
  • Then use execute_read_script with X.** or expand X.$calcid to inspect the rows.