hi Crispin, below is the run method. thank you so much! public void run() { #avifiles LedgerRowDefLine ledgerRowDefLine; LedgerRowDefLine tmpLedgerRowDefLine; SysOperationProgress sysOperationProgress; int idx_calc; int j; int i; container orgMainRowsList; container tmpMainRowsList; boolean makeEngineCalc; Map engineValues; MapIterator itEngineValues; Map columnValues; Map rowsCalcExpression; AmountMST sumAmountSF; int key; LedgerBalColumnsDim ledgerBalColumnsDim; NoYes exceptionCheck; ; engine = new LedgerTransReportEngine(); valueSheet = new Map(Types::Integer, Types::Class); if (dimensionsOutputType == DimensionsOutputTypeEnum::Export) { ledgerBalanceSheetDimFile = LedgerBalanceSheetDimFile::construct(LedgerBalanceSheetDimFileFormat::findFormat(exportFormat).ClassId); if (ledgerBalanceSheetDimFile.showDialog()) { ledgerBalanceSheetDimFile.getLastValueStored(this.exportPromptLastValueKey()); } } engine.parmFocus(mainFocus, secondaryFocus); exceptionCheck = LedgerRowDefLine::checkException(rowDefinition); if (secondaryFocus) { valueSheetMF = new Map(Types::Integer, Types::Class); headerRowsList = this.constructRowsList(mainFocus, rowDefinition); headerRowsListIdx = LedgerRowDef::renumerateMainLinesListIdx(headerRowsList); mainRowsList = this.constructRowsList(secondaryFocus, rowDefinitionSec, false); mainRowsListIdx = LedgerRowDef::renumerateMainLinesListIdx(mainRowsList); this.buildColumnsCalcList(); rowsCalcExpression = this.buildRowsCalcList(mainRowsList,mainRowsListIdx); sysOperationProgress = SysOperationProgress::newGeneral(#aviupdate, "@SYS81753", conlen(headerRowsList)); orgMainRowsList = mainRowsList; makeEngineCalc = true; for (idx_calc = 1; idx_calc<=conlen(headerRowsList); idx_calc++) { sysOperationProgress.incCount(); ledgerRowDefLine = conpeek(headerRowsList, idx_calc); if (ledgerRowDefLine.Type == DimensionsLedgerDimensionType::Element) { statementEngine = new LedgerTransStatementEngine(); statementEngine.parmFocus(mainFocus, secondaryFocus); statementEngine.parmExceptionCheck(exceptionCheck); // Merge the criteria/ranges from the main and secondary focus tmpMainRowsList = connull(); for (j = 1; j <=conlen(orgMainRowsList); j++) { tmpLedgerRowDefLine = conpeek(orgMainRowsList, j); if (ledgerRowDefLine.AccountCriteria) { tmpLedgerRowDefLine.AccountCriteria = ledgerRowDefLine.AccountCriteria; } for (i=1; i <= dimof(ledgerRowDefLine.DimensionCriteria) ; i++) { if (ledgerRowDefLine.DimensionCriteria[i]) { tmpLedgerRowDefLine.DimensionCriteria[i] = ledgerRowDefLine.DimensionCriteria[i]; } } // Reverse sign setting needs to be rolled down from the main focus row def line to the secondary focus // row def line in case when no secondary focus row definition was specified. if(!rowDefinitionSec) { tmpLedgerRowDefLine.ReverseSign = ledgerRowDefLine.ReverseSign; } tmpMainRowsList += [tmpLedgerRowDefLine]; } // Fetch the data for the secondary focus mainRowsList = tmpMainRowsList; this.calculateStatement(ledgerRowDefLine.AccountCriteria, ledgerRowDefLine.DimensionCriteria, makeEngineCalc); this.statementEngineCalculate(mainRowsList, mainRowsListIdx, rowsCalcExpression, statementEngine); engineValues = statementEngine.getCacheMap(); valueSheet.insert(idx_calc, engineValues); makeEngineCalc = false; // go through the secondary colums and create a map for the main focus with as a sum of the sub elements. itEngineValues = new MapIterator(engineValues); while (itEngineValues.more()) { columnValues = itEngineValues.value(); key = itEngineValues.key(); if (columnValues.exists(0)) { sumAmountSF = columnValues.lookup(0); } else { sumAmountSF = 0; } this.insertMainFocusValues(ledgerRowDefLine.RecId, key, sumAmountSF); itEngineValues.next(); } } else { // create a value sheet with the values zero for groups and calulations. // The values will be updatet when the main list has been updated. sumAmountSF = 0; while select ledgerBalColumnsDim index BalColIdx where ledgerBalColumnsDim.BalanceSheet == balanceSheet { this.insertMainFocusValues(ledgerRowDefLine.RecId, ledgerBalColumnsDim.Column, sumAmountSF); } } } if (conlen(headerRowsList)) { this.updateMFSumOnGroups(); this.makeMFCalculations(); switch(dimensionsOutputType) { case DimensionsOutputTypeEnum::Standard : this.runReport(true); break; case DimensionsOutputTypeEnum::Export : this.runExport(); break; } } } else { statementEngine = new LedgerTransStatementEngine(); statementEngine.parmFocus(mainFocus, secondaryFocus); statementEngine.parmExceptionCheck(exceptionCheck); mainRowsList = this.constructRowsList(mainFocus, rowDefinition); mainRowsListIdx = LedgerRowDef::renumerateMainLinesListIdx(mainRowsList); this.buildColumnsCalcList(); rowsCalcExpression = this.buildRowsCalcList(mainRowsList,mainRowsListIdx); this.calculateStatement(accountCriteria, dimensionCriteria); mainRowsListIdx = LedgerRowDef::renumerateMainLinesListIdx(mainRowsList); this.statementEngineCalculate(mainRowsList, mainRowsListIdx, rowsCalcExpression, statementEngine); valueSheet.insert(0, statementEngine.getCacheMap()); switch(dimensionsOutputType) { case DimensionsOutputTypeEnum::Standard : this.runReport(false); break; case DimensionsOutputTypeEnum::XBRL : this.runXBRL(); break; case DimensionsOutputTypeEnum::Export : this.runExport(); break; } } }
↧