Search Posts

Visits: 746

Definition

Specify xbrli:xbrl for ancestorFilter, target all items including characters in typedDimension, add up the total amount of credit with test=”../gl-cor:debitCreditCode eq 'C'” and debit with ‘D’ in test of the filter, and verify whether the total amounts match.

Note: The files can be found at GitHub.

	<gen:link xlink:type="extended" xlink:role="http://www.xbrl.org/2008/role/link">
	<!-- formula -->
		<formula:formula id="formula_balance" aspectModel="dimensional" implicitFiltering="true" value="if (abs(sum( $creditAmts ) - sum( $debitAmts )) lt 1.0)   then concat(&apos;Credit Amounts(&apos;,sum($creditAmts),&apos;) Debit Amounts(&apos;,sum($debitAmts),&apos;) is in balance&apos;)   else concat(&apos;Credit Amounts(&apos;,sum($creditAmts),&apos;)Debit Amounts(:&apos;,sum($debitAmts),&apos;) is not in balance&apos;)" source="formula:uncovered" xlink:type="resource" xlink:label="formula_balance">
			<formula:aspects>
				<formula:concept>
					<formula:qname>gl-cor:entriesComment</formula:qname>
				</formula:concept>
			</formula:aspects>
		</formula:formula>
	<!-- variableArc -->
		<variable:variableArc name="debitAmts" order="1.0" xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set" xlink:from="formula_balance" xlink:to="debitAmount"/>
		<variable:variableArc name="creditAmts" order="2.0" xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-set" xlink:from="formula_balance" xlink:to="creditAmount"/>
	<!-- factVariable -->
		<variable:factVariable id="creditAmount" bindAsSequence="true" xlink:type="resource" xlink:label="creditAmount"/>
		<variable:factVariable id="debitAmount" bindAsSequence="true" xlink:type="resource" xlink:label="debitAmount"/>
	<!-- variableFilterArc -->
		<variable:variableFilterArc order="1.0" complement="false" cover="true" xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-filter" xlink:from="creditAmount" xlink:to="amount_nameFilter"/>
		<variable:variableFilterArc order="2.0" complement="false" cover="true" xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-filter" xlink:from="creditAmount" xlink:to="Credit_filter"/>
		<variable:variableFilterArc order="3.0" complement="false" cover="true" xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-filter" xlink:from="creditAmount" xlink:to="typedDimension"/>
		<variable:variableFilterArc order="4.0" complement="false" cover="true" xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-filter" xlink:from="creditAmount" xlink:to="typedDimension1"/>
		<variable:variableFilterArc order="5.0" complement="false" cover="true" xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-filter" xlink:from="creditAmount" xlink:to="ancestorFilter"/>
		<variable:variableFilterArc order="6.0" complement="false" cover="true" xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-filter" xlink:from="debitAmount" xlink:to="amount_nameFilter"/>
		<variable:variableFilterArc order="7.0" complement="false" cover="true" xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-filter" xlink:from="debitAmount" xlink:to="Debit_filter"/>
		<variable:variableFilterArc order="8.0" complement="false" cover="true" xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-filter" xlink:from="debitAmount" xlink:to="typedDimension"/>
		<variable:variableFilterArc order="9.0" complement="false" cover="true" xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-filter" xlink:from="debitAmount" xlink:to="typedDimension1"/>
		<variable:variableFilterArc order="10.0" complement="false" cover="true" xlink:type="arc" xlink:arcrole="http://xbrl.org/arcrole/2008/variable-filter" xlink:from="debitAmount" xlink:to="ancestorFilter"/>
	<!-- filter -->
		<cf:conceptName id="amount_nameFilter" xlink:type="resource" xlink:label="amount_nameFilter">
			<cf:concept>
				<cf:qname>gl-cor:amount</cf:qname>
			</cf:concept>
		</cf:conceptName>
		<gf:general id="Debit_filter" test="../gl-cor:debitCreditCode eq &apos;D&apos;" xlink:type="resource" xlink:label="Debit_filter"/>
		<gf:general id="Credit_filter" test="../gl-cor:debitCreditCode eq &apos;C&apos;" xlink:type="resource" xlink:label="Credit_filter"/>
		<tf:ancestorFilter id="ancestorFilter" xlink:type="resource" xlink:label="ancestorFilter">
			<tf:ancestor>
				<tf:qname>xbrli:xbrl</tf:qname>
			</tf:ancestor>
		</tf:ancestorFilter>
		<pf:periodInstant id="periodInstant" date="2020-01-01" xlink:type="resource" xlink:label="periodInstant"/>		
		<df:typedDimension id="typedDimension" test="string-length(gl-cor:EntryNumber) &gt; 0" xlink:type="resource" xlink:label="typedDimension">
			<df:dimension>
				<df:qname>gl-cor:dEntryNumber</df:qname>
			</df:dimension>
		</df:typedDimension>
		<df:typedDimension id="typedDimension1" test="string-length(gl-cor:LineNumber) &gt; 0" xlink:type="resource" xlink:label="typedDimension1">
			<df:dimension>
				<df:qname>gl-cor:dLineNumber</df:qname>
			</df:dimension>
		</df:typedDimension>
	</gen:link>
Execution result of formula linkbase

Altova XML Spy

arelle