Rules

An archive can contain business rules that can either compute new facts out of existing facts, or validate that facts fulfill certain conditions.

Internally, rules are written in the JSONiq language, however UIs often isolate users from this and use user-friendly machinery or Excel-like formulas instead.

API Reference

We provide a complete reference to the REST API for rules.

Spreadsheet analogy

Rules can be seen as the formulas in a spreadsheet.

Best practice

A warmly recommended best practice is to explicitly include all facts in a filing, and have validation rules that check their consistency.

Rules that compute new facts can be very useful while creating new archives, but actually including these rules in the produced filing rather than the computed facts themselves is strongly discouraged. This discouraged practice would be come down, in real life, to handing out fancy printed copies of fiscal reports with missing values, leaving instructions for the reader to calculate these values themselves.

XBRL terminology

In XBRL, rules can correspond to:

  1. Calculation networks. Calculation relationships are mapped to roll-up validation rules, one for each non-leaf concept in the calculation network.
  2. XBRL Formulas. The cell store can import some XBRL formulas as rules. At the moment, it is capable of recognizing XBRL value assertion formulas that are roll-up validations, that is, only covering the xbrl:Concept aspect. More will be recognized in the future.

Furthermore, upon import of a filing, the cell store can automatically infer roll-up and roll-forward rules from the presentation and definition networks.

Automatic rule inferrence

Roll-up validations

Roll-up validation rules are inferred when a presentation contains numeric concepts, and the last sibling under an abstract is taken as the total of its other siblings. The + and - signs are inferred from the balance attribute of the concepts.

Roll up example

Roll-forward validations

Roll-forward validation rules are inferred when a presentation contains numeric concepts, when the same concept appears twice under an abstract, once with a preferred label role of http://www.xbrl.org/2003/role/periodStartLabel and once with a preferred label role of http://www.xbrl.org/2003/role/periodEndLabel. The concept of the end period is obtained by adding all other sibling concepts to the concept of the beginning period. The + and - signs are inferred from the balance attribute of the concepts.