Presentation is loading. Please wait.

Presentation is loading. Please wait.

Formula Linkbase Tutorial (afternoon)

Similar presentations


Presentation on theme: "Formula Linkbase Tutorial (afternoon)"— Presentation transcript:

1 Formula Linkbase Tutorial (afternoon)
David vun Kannon Phillip Engel KPMG LLP

2 WWSD? Remember! XBRL OTSOG W3C XBRL FL OTSOG XPath Therefore: and
(What Would SQL do?)

3 Basic Design Decisions
How important is extensibility? Do you need a linkbase or just appinfo? How important is it to fit into existing tool sets and thinking? Is FL A resource linkbase? Item – formula A relationship linkbase? Item – inputs (+ formula)

4 Linkbase Separates definition of formula from output item
Allows prohibition and override Uses linkbase ideas popularized by XBRL 2.1 But Can’t use the linkbase element!

5 Top Level Design <fl:rulebase> <fl:formulaLink/>
Except for substituting rulebase for linkbase, this is a standard XBRL linkbase, with extended link roles for DTS use. (Don’t want to break the DTS model!)

6 Inputs are buried in the formula
formulaLink Design Inputs are buried in the formula <fl:formulaLink> <fl:formula/> <xl:loc/> <fl:formulaArc/> </fl:formulaLink> This is very similar to other (label, reference) “resource style” linkbases. Result element

7 formulaArc Design Only one arc role defined so far Item-formula

8 Formula Design <fl:formula xlink:type=“resource”
xlink:label=“formula1” id = “myFormula1” > <fl:variable/> <fl:value/> <fl:result/> </fl:formula>

9 Variable Design <fl:variable name = “var1” select = “ci:Assets”
filter = “ …XPath expression… ” /> What are you allowed to select? items, contexts, non-XBRL attributes? The idea of “free” variables.

10 Value Design <fl:value test = “ …Xpath expression…”
select = “ …XPath expression…” /> Can use multiple value elements OR XPath 2.0 case construct in XPath expression.

11 Result Design <fl:result> <fl:resultPrecision/>
<fl:resultUnit/> <fl:resultContext> <fl:resultEntity/> <fl:resultPeriod/> <fl:resultScenario/> </fl:resultContext> </fl:result>

12 FL OTSOG XPath! Bind variables Filter variables Result choices
Compute results Express API into XBRL instance documents

13 An XPath-based API Standard predicates (functions) of XBRL 2.1
C-equal P-equal S-equal U-equal Duplicate-item Specific to the needs of Formula Linkbase Decimal to precision conversion

14 Basic processing model
Formula Linkbase XBRL Instance in Process Formulas Non-deterministic order XBRL Instance out Individual formula Bind variables Input Value expression Process Create result Output XBRL Instance DTS and Formula Linkbase New Formula Processor

15 Formula linkbase example – Average Shares
<formulaLink xlink:type="extended" xlink:role=" <link:loc xlink:type="locator" xlink:label="item" xlink:href="testFLconcepts.xsd#Assets"/> <formulaArc xlink:type="arc" xlink:from="item" xlink:to="formula" xlink:arcrole=" <formula xlink:type="resource" xlink:label="formula" id="formula_2.3_AvgShares"> <variable select="co:CurrentAssets" name="CurrentAssets"/> <variable select="co:FixedAssets" name="FixedAssets" filter="flf:context-eq($this.context, $CurrentAssets.context) and flf:unit-eq($this.unit, $CurrentAssets.unit)"/> <value select="CurrentAssets.value + $FixedAssets.value"/> <result> <resultContext select="$CurrentAssets.context"/> <resultUnit select="$CurrentAssets.unit"/> </result> </formula> </formulaLink> Variables Value expression Formula Result creation

16 Binding variables Set up the inputs to the formula
Bind to information at the XBRL abstraction level Facts (items and tuples) Contexts and Units Bind to other XML data? Filtering Absolute and relative filters Relate to other variable bindings XBRL equalities Free variables

17 Binding Variables <variable select="selction XPath expression" filter="filtering XPath expression" OR filterRef="filter id"/> Binding in two steps 1. Select – XPath expression, context node is <XBRL> 2. Filter – Boolean XPath expression tested on each occurrence of the “select”. <variable select="co:CurrentAssets" name="CurrentAssets"/> <variable select="co:FixedAssets" name="FixedAssets" filterRef="rf2.1"/> <filter id="rf2.1" test="$this.context is $CurrentAssets.context and flf:unit-eq($this.unit, $CurrentAssets.unit) and flf:parent-eq($fact, $CurrentAssets)"/>

18 Binding Variables <variable select="selction XPath expression" filter="filtering XPath expression" OR filterRef="filter id"/> Binding in two steps 1. Select – XPath expression, context node is <XBRL> 2. Filter – Boolean XPath expression tested on each occurrence of the “select”. <variable select="co:CurrentAssets" name="CurrentAssets" filter="$this.instant=‘ ’"/> <variable select="co:FixedAssets" name="FixedAssets" filterRef="rf2.1"/> <filter id="rf2.1" test="$this.context is $CurrentAssets.context and flf:unit-eq($this.unit, $CurrentAssets.unit) and flf:parent-eq($fact, $CurrentAssets)"/>

19 Binding variables - Filtering
Absolute filters – do not rely any other XBRL variable bindings Relative filters – use other variables bindings to express a relationship between the variable being filtered and other variable bindings $this variable – The current “select” being tested in the filter. XBRL functions for filters context-eq(), unit-eq(), parent-eq(), isFact(), isItem(), isTuple() <variable select="co:CurrentAssets" name="CurrentAssets" filter="$this.instant=‘ ’"/> <variable select="co:FixedAssets" name="FixedAssets" filterRef="rf2.1"/> <filter id="rf2.1" test="$this.context is $CurrentAssets.context and flf:unit-eq($this.unit, $CurrentAssets.unit) and flf:parent-eq($fact, $CurrentAssets)"/>

20 Free variables Each XBRL variables creates a set of XPath variables based on what type of XBRL object is bound. Items Context Unit .value .context .period .startDate .endDate .instant .entity .identifier .segment .scheme .scenario .period .startDate .endDate .instant .entity .identifier .measure

21 Value expressions Cartesian product of bindings
Pre-testing – boolean XPath expression Formula expression – XPath expression <value select="$CurrentAssets.value + $FixedAssets.value"/> <value test="true()" select="$Earnings.value / $Shares.value"/> <value test="$Shares" select="$Earnings.value / $Shares.value"/> <value test="$AvgShares" select="$Earnings.value / $AvgShares.value"/> <value select="fn:months-from-durations($Assets.instant - $PrevAssets.instant)"/>

22 Create the result Value production Context and unit production
Described from inputs or constants Tuples – the problem child <result> <resultContext select="$CurrentAssets.context"/> <resultUnit select="$CurrentAssets.unit"/> </result> <resultPeriod> <resultStartDate select="$Shares.instant + P1D"/> <resultEndDate select="$SharesNext.instant"/> </resultPeriod> <resultEntity select="$Shares.entity"/> <resultScenario select="$Shares.scenario"/> <resultUnit select="$Shares.unit"/>

23 Formula linkbase example – Average Shares
<formulaLink xlink:type="extended" xlink:role=" <link:loc xlink:type="locator" xlink:label="item" xlink:href="testFLconcepts.xsd#AvgShares"/> <formulaArc xlink:type="arc" xlink:from="item" xlink:to="formula" xlink:arcrole=" <formula xlink:type="resource" xlink:label="formula" id="formula_2.3_AvgShares"> <variable select="co:Shares" name="SharesNext"/> <variable select="co:Shares" name="SharesPrev" filter="$this.period = $SharesNext.period - P1Y and flf:unit-eq($this.unit, $SharesNext.unit)"/> <value select="($SharesNext.value + $SharesPrev.value) / 2"/> <result> <resultPeriod> <resultStartDate select="$Shares.instant + P1D"/> <resultEndDate select="$SharesNext.instant"/> </resultPeriod> <resultEntity select="$SharesPrev.entity"/> <resultScenario select="$SharesPrev.scenario"/> <resultUnit select="$SharesPrev.unit"/> </result> </formula> </formulaLink> Result Item Result Item

24 Expressing formulas as metadata
Requirements balance The formula linkbase has to find a balance between: Expressing formulas as metadata vs. Processing formulas

25 Demo formula processor implementation
Written in XSLT – easy to create (OTSOG!!!) Transforms a formula linkbase into an XSLT stylesheet Each formula becomes a named template An instance document is the input to the generated stylesheet Output is a new valid instance document


Download ppt "Formula Linkbase Tutorial (afternoon)"

Similar presentations


Ads by Google