Hi
I have an AOT query, which I use datasource for my form. In that query I have 4 ranges. When I run the form, it prompts as expected with the query window.
It opens the form with the expected result.
I have a button that must create a ledgerjournaltable and journaltrans out of the records from the form.
When I click on the button It runs through ALL the records and not the filtered records.
Here is my code for the Click() of the button:
void clicked() { AxLedgerJournalTable journalTable; // class AxLedgerJournalTrans journalTrans; // class container acctPattern; container offSetAcctPattern; DimensionDefault dimensionDefault; ProjTable projTableLocal; MainAccount mainAccount; LedgerJournalTrans ledgerJournalTrans; DimensionDynamicAccount ledgerDimension, offsetLedgerDimension; Query query = new Query(queryStr (NCProjForeCastCostHEN)); // Query name. QueryRun qr; QueryBuildRange qbr; ; journalTable = new AxLedgerJournalTable(); journalTrans = new AxLedgerJournalTrans(); //Opret ny hensættelseskladde journalTable.parmJournalName("HEN"); journalTable.save(); // Kør query qr = new QueryRun(query); // Find range qbr = query.dataSourceTable( tablenum (ProjForecastCost)) .findRange( fieldNum (ProjForecastCost, ProjId)); qbr = query.dataSourceTable( tablenum (ProjForecastCost)) .findRange( fieldNum (ProjForecastCost, ModelId)); qbr = query.dataSourceTable( tablenum (ProjForecastCost)) .findRange( fieldNum (ProjForecastCost, StartDate)); qbr = query.dataSourceTable( tablenum (ProjTable)) .findRange( fieldNum (ProjTable, ProjInvoiceProjId)); //Opretter kladdelinjer while (qr.next()) { projTable = projTable::find(ProjForecastCost_1.ProjId); projTableLocal = ProjTable::find(ProjForecastCost_1.ProjId); dimensionDefault = projTableLocal.DefaultDimension; select RecId from mainAccount where mainAccount.MainAccountId == "93075"; ledgerDimension = DimensionStorage::getDefaultAccount(mainAccount.RecId); offsetLedgerDimension = LedgerJournalName::find("HEN").OffsetLedgerDimension; ttsbegin; ledgerJournalTrans.JournalNum = journalTable.parmJournalNum(); ledgerJournalTrans.TransDate = systemDateGet(); ledgerJournalTrans.Txt = "Hensat - " + projTable.Name; ledgerJournalTrans.AccountType = LedgerJournalACType::Ledger; ledgerJournalTrans.OffsetAccountType = LedgerJournalACType::Ledger; ledgerJournalTrans.LedgerDimension = DimensionDefaultingService::serviceCreateLedgerDimension(ledgerDimension, dimensionDefault); ledgerJournalTrans.OffsetLedgerDimension = DimensionDefaultingService::serviceCreateLedgerDimension(offsetLedgerDimension, dimensionDefault); ledgerJournalTrans.CurrencyCode = ProjForecastCost_1.CurrencyId; ledgerJournalTrans.insert(); ttsCommit; info(strFmt("Journalnr. %1 er oprettet.", journalTable.ledgerJournalTable().JournalNum)); } super(); }
*This post is locked for comments