$treeElements = navigate parent-child descendants from ferc:CashFlowLineItems role "http://ferc.gov/form/2020-01-01/roles/Schedule/F1/ScheduleStatementOfCashFlows" returns list (target, preferred-label, result-order);
$data-labels = list(for $row in $treeElements
$concept = $row[1];
$row_num = (filter $concept.references("http://ferc.gov/form/2020-01-01/roles/reference/formLocation") where ($item.part-by-name(ferc-part:Schedule).part-value == "120 - Schedule - Statement of Cash Flows" and $item.part-by-name(ferc-part:ValueType).part-value.string == "Label")).to-list;
$conceptPeriod = $concept.period-type;
$beginningBalance = if $row[2].role.uri == "http://ferc.gov/form/2020-01-01/roles/label/F1BeginningBalance"
true
else
false
$beginningRow = if ($row_num.part-by-name(ferc-part:Row)).length > 0
min(($row_num.part-by-name(ferc-part:Row)).part-value)
else
""
$endingRow = if ($row_num.part-by-name(ferc-part:Row)).length > 0
max(($row_num.part-by-name(ferc-part:Row)).part-value)
else
""
$current = if $conceptPeriod == "duration"
if exists(first(list([covered @concept = $row[1] @period = $currentDuration])))
first(list([covered @concept = $row[1] @period = $currentDuration]))
else
none
else
if $beginningBalance
if exists(first(list([covered @concept = $row[1] @period = $priorInstant])))
first(list([covered @concept = $row[1] @period = $priorInstant]))
else
none
else
if exists(first(list([covered @concept = $row[1] @period = $currentInstant])))
first(list([covered @concept = $row[1] @period = $currentInstant]))
else
none
$prior = if $conceptPeriod == "duration"
if exists(first(list([covered @concept = $row[1] @period = $priorDuration])))
first(list([covered @concept = $row[1] @period = $priorDuration]))
else
none
else
if $beginningBalance
if exists(first(list([covered @concept = $row[1] @period = $prior2Instant])))
first(list([covered @concept = $row[1] @period = $prior2Instant]))
else
none
else
if exists(first(list([covered @concept = $row[1] @period = $prior12MonthsInstant])))
first(list([covered @concept = $row[1] @period = $prior12MonthsInstant]))
else
none
$sequenceReferences = (filter $concept.references("http://ferc.gov/form/2020-01-01/roles/reference/elementSequence") where ($item.part-by-name(ferc-part:ScheduleRole).part-value == "http://ferc.gov/form/2020-01-01/roles/Schedule/F1/ScheduleStatementOfCashFlows") returns $item.part-by-name(ferc-part:SequenceRole).part-value).to-list;
/*** $breakdown = list($sequenceReferences.to-list);***/
$breakdown = list(
if $sequenceReferences.to-list.length > 0
$sequenceRole = $sequenceReferences[1];
$sequenceElements = navigate parent-child descendants role $sequenceRole returns list(target, preferred-label, result-order);
$axis = first(list(for $a in $sequenceElements
if $a.length > 0
$conceptRoll = $a[1];
if $conceptRoll.substitution.local-name == "dimensionItem"
$conceptRoll
else
skip
else
skip));
$lineItemsList = list(for $l in $sequenceElements
if $l.length > 0
$conceptRoll = $l[1];
if $conceptRoll.is-abstract
skip
else
$l
else
skip
);
$data1 =
list({covered {list(
if exists({@ferc:OrderNumber @unit=* @period = $currentDuration where $fact.dimension($axis) != none})
{@ferc:OrderNumber @unit=* @period = $currentDuration where $fact.dimension($axis) != none}
else
0,
if ($row_num.part-by-name(ferc-part:Row)).length > 0
($row_num.part-by-name(ferc-part:Row))[1].part-value
else
"",
$lineItemsList[3][1],
if exists({@concept = $lineItemsList[3][1] @unit @period = $currentDuration where $fact.dimension($axis) != none})
{@concept = $lineItemsList[3][1] @unit @period = $currentDuration where $fact.dimension($axis) != none}
else
none,
if exists({@concept = $lineItemsList[2][1] @unit @period = $currentDuration where $fact.dimension($axis) != none} )
{@concept = $lineItemsList[2][1] @unit @period = $currentDuration where $fact.dimension($axis) != none}
else
none,
if exists({@concept = $lineItemsList[2][1] @unit=* @period = $priorDuration where $fact.dimension($axis) != none})
{@concept = $lineItemsList[2][1] @unit=* @period = $priorDuration where $fact.dimension($axis) != none}
else
none
)}});
$data2 = list(for $x in $data1
if $x == list(0,$x[2],$x[3],none,none,none)
skip
else
$x);
$orders = set(for $x in $data2 $x[1]).sort;
$orderedData = list(for $order in $orders
for $row in $data2
if $row[1] != $order
skip
else
$row );
$data = list(for $z in range($orderedData.length)
$updatedNumber = $orderedData[$z][2].string + "." + $z.string;
list($orderedData[$z][1],$updatedNumber,$orderedData[$z][3],$orderedData[$z][4],$orderedData[$z][5],$orderedData[$z][6])
);
for $row in $data
$row
else
skip
);
list(list(
0,
if $beginningBalance
$beginningRow
else
$endingRow,
$concept,
$concept.label($row[2].role.uri).text,
$current,
$prior
)) + $breakdown
);
for $rows in $data-labels
for $rowl in $rows
$rowl[2]
1
|
|
$rowl[5]
if $rowl[3].is-abstract "gray-out" else ""
300
if $rowl[3].name in list(ferc:NetIncreaseDecreaseInReceivablesOperatingActivities,ferc:NetIncreaseDecreaseInInventoryOperatingActivities,ferc:NetIncreaseDecreaseInOtherRegulatoryAssetsOperatingActivities,ferc:GrossAdditionsToUtilityPlantLessNuclearFuelInvestingActivities,ferc:GrossAdditionsToNuclearFuelInvestingActivities,ferc:GrossAdditionsToCommonUtilityPlantInvestingActivities,ferc:GrossAdditionsToNonutilityPlantInvestingActivities,ferc:AllowanceForOtherFundsUsedDuringConstructionInvestingActivities,ferc:OtherConstructionAndAcquisitionOfPlantInvestmentActivities,ferc:CashOutflowsForPlant,ferc:InvestmentsInAndAdvancesToAssociatedAndSubsidiaryCompanies,ferc:PaymentsForRetirementOfLongTermDebtFinancingActivities,ferc:PaymentsForRetirementOfPreferredStockFinancingActivities,ferc:PaymentsForRetirementOfCommonStockFinancingActivities,ferc:NetDecreaseInShortTermDebt, ferc:OtherRetirementsOfBalancesImpactingCashFlowsFromFinancingActivities) "-" else none
|
$rowl[6]
if $rowl[3].is-abstract "gray-out" else ""
300
if $rowl[3].name in list(ferc:NetIncreaseDecreaseInReceivablesOperatingActivities,ferc:NetIncreaseDecreaseInInventoryOperatingActivities,ferc:NetIncreaseDecreaseInOtherRegulatoryAssetsOperatingActivities,ferc:GrossAdditionsToUtilityPlantLessNuclearFuelInvestingActivities,ferc:GrossAdditionsToNuclearFuelInvestingActivities,ferc:GrossAdditionsToCommonUtilityPlantInvestingActivities,ferc:GrossAdditionsToNonutilityPlantInvestingActivities,ferc:AllowanceForOtherFundsUsedDuringConstructionInvestingActivities,ferc:OtherConstructionAndAcquisitionOfPlantInvestmentActivities,ferc:CashOutflowsForPlant,ferc:InvestmentsInAndAdvancesToAssociatedAndSubsidiaryCompanies,ferc:PaymentsForRetirementOfLongTermDebtFinancingActivities,ferc:PaymentsForRetirementOfPreferredStockFinancingActivities,ferc:PaymentsForRetirementOfCommonStockFinancingActivities,ferc:NetDecreaseInShortTermDebt,ferc:OtherRetirementsOfBalancesImpactingCashFlowsFromFinancingActivities) "-" else none
|