Start from the visible target
Inspect the saved table, and copy the returned row or column reference intoedit_table_blocks:
- Use a row or a column for a formula that applies along that axis.
- Use a cell for one exact visible result.
Write a condition
When you write a condition yourself, use the readable Dimension and item names that inspection returns. Put backticks around names with spaces, and add a returned reference’s short suffix only when needed.
A condition with no Date term, such as
[], can supply inherited defaults in both Actuals and Forecast.
Exact and inheriting conditions
A condition without$ can still match a richer cell address. A condition that begins with $ matches exactly the set of Dimensions it names:
- A
cell_updatesentry saves one formula per selected cell at that cell’s exact address, so one row across 60 period columns saves 60 formulas, andclear_formularemoves them. When a formula already sits at that address, the write replaces its text and keeps its saved matching mode. - A
row_updatesentry’sdefault_formulassaves one inheriting formula that covers every period in its range. A formula the row already owns keeps its saved scope and matching mode. - On a timeless row with one value column, the cell’s coordinates are the row’s own, so the edit writes or removes the row’s formula.
$ belongs to the condition grammar. In an expression, an absolute reference puts $ after the Variable’s name instead: Revenue$[Department = "Sales"].
Use exact scope only when the user intends that narrower behavior. A formula that leaves out Date cannot fill dated cells when it matches only its exact set of Dimensions.
How results describe a formula’s reach
Formula reads and write receipts describe each saved default’s scope the same way:- its condition and its range;
- its Date grain, when the formula is dated:
time_grainin a read,Date grain: <grain>in a receipt; - its reach in words.
includes additional dimensionsmeans an inheriting[...]condition that also covers cells carrying more business Dimensions, at the same Date grain.this grain onlymeans an exact$[...]condition.
Actuals and Forecast ranges
Formula ranges separate parts of the timeline that use different calculations. Actuals and Forecast are defined relative to a Scenario’s Last close, and each Scenario has its own. Interpret a formula range against the boundary of the Scenario you read or write: the onescenario names, or the Scenario in view when the call leaves scenario out.
Let the visible target choose the range
When the formula belongs to a visible row, column, or cell, inspect the saved table and useedit_table_blocks to target the actual result. The server derives the formula range from the target, so you do not invent or fetch a formula-range ID.
Dated formulas need Date at the base grain
A formula for Actuals or Forecast needs Date in its condition, at the Model’s base grain. In a monthly Model:default_formulas.actuals or default_formulas.forecast on a row or a column, or in a variables entry of edit_table_blocks. A formula saved through a variables entry gets one Date term at the Model’s base grain automatically, whether or not the call also names a table, because the formula belongs to the Variable and not to a table. Only a formula written on a row or column of a table whose periods are coarser than the base grain is saved at that table’s grain; Create and update formulas describes that warning.
Read Last close when it matters
Adimension read of Date, and each Scenario in inspect_scenarios, returns the Scenario’s calendar: last_close, its default granularity, and its default range. A table grid read does not carry it. Read the calendar when you need to confirm Last close, because the boundary decides which dates count as Actuals and which belong to Forecast. edit_table_blocks update_calendar changes these settings for the Scenario; every table in the Scenario shares them.
If the Scenario has no Last close, explain the missing setting before you build a result that depends on the range.