DecCF./ˈdɛk.ɛf/

Model a household with declarative rows and funding

Declare each person once as a typed row. input.objectArray() provides the schema and initial values; the Calculator uses that schema to create editable person cards with add and remove controls. repeat() uses each row to create its entity and the declarations that depend on that person. Stable IDs keep the rows connected when someone is added, removed, or reordered.

Filter the repeated collection to select adults, then use the salary column as weights in proportional(). A household budget can use funding to turn that allocation into balanced transfers to the household. The engine owns row binding, allocation, account resolution, and transfer posting. The model only states the domain fields and rule.

To explore the full Household budget · proportional funding model, open Calculator App Editor, choose Start from an example, then select that example. The Household budget · fixed contributions example is in the same picker; it uses the same cards and repeats salary and Swedish tax per adult, then transfers each person's declared monthly contribution. Both open as editable examples without Marketplace installation.

You can extend the row schema with fields such as familyRole, dateOfBirth, salary, or contribution. Use input.enum() for a closed set of roles, input.money() for currency-bound values, and input.id({ generate: "uuid" }) for generated IDs on new cards. An explicit item schema lets users start with an empty collection. Required fields remain editable in the draft and are validated when the model runs.

Pick the right declaration

Use allocation() when you need a report of calculated shares and do not want to book payments. Use transfer() for a known payment between two owners. Use funding() when a need should be allocated across sources and those allocations should be posted as transfers. Each layer reuses the same proportional or priority solver.

householdBudget({ household, members, funding }) composes a domain budget need with the general funding rule. Read result.component(budget).total for need by period and fundingShares, fundingShortfall, and fundingTransfers when a funding rule is present. The budget payments remain ordinary account postings and are counted once in cashflow totals.

Saved Calculator models keep their input rows and named scenario drafts with the source. Each scenario has an independent collection, so adding or removing one person's card in a scenario does not change the base model or another scenario.

Different lists can have their own stable IDs. Use lookup(sourceMap, key, { fallback }) to relate a loan, payment or account to a row in another list. For example, lookup(people.outputs.person, loanRow.ownerId) selects that loan's person, while lookup(properties.column("value"), loanRow.propertyId) selects the property's value. Repeated account and calculation outputs can be selected in the same way.

Declare the source repeat in the model's components, directly or within an ordinary component. It can appear before or after the component that uses it. A missing key fails clearly; no related row is silently replaced with zero. Omit fallback for required relationships, or supply an explicit fallback such as the shared household owner. Related rows are selected again when scenario rows change.

Lists can also be nested: repeat the property cards, then repeat each property's loan cards. A loan can read both its own row fields and the enclosing property's valuation. Local loan IDs may be reused under different properties; each result remains attached to its own property.

Fund a recipient's own share

A funding rule inside a repeated list can use the whole people.outputs.person map as its sources while taking weights from the current row's nested list. Source IDs must match the weight IDs exactly. Use lookup(people.outputs.person, row.recipientId) to choose the destination by its ID.

Set retainOwnShare: true when the recipient is also one of the funding sources. Its allocated share stays in its existing cash account, and the other sources transfer their shares. For example, a recipient responsible for 25% of a 40 SEK payment retains 10 SEK and receives 30 SEK from the other source. The separate expense still pays the full 40 SEK.

outputs.shares and outputs.allocated include that retained obligation. outputs.transfers reports zero for the retained source, and outputs.retained reports its total as Money. Retention applies only when both endpoints resolve to the same cash account; different accounts belonging to one person still transfer normally. Limits, shortfall rules, and source validation also apply to retained shares. Without this option, funding continues to reject transfers back to the same endpoint.