Record Insert List to insert data in one SQL Call.
Helps in improve performance
RecordInsertList tmpValueReporting = new RecordInsertList(tableNum(VendProvisionalBalanceTmpValue),
false, false, false, false, true, vendProvisionalBalanceTmpValue);
while select crosscompany AccountNum, ADLegalEntity, MainAccountId
from vendProvisionalBalanceTmpProcessing
group by AccountNum, MainAccountId, ADLegalEntity
join PostingProfile, IsSummaryAccount, sum(AmountAccounting),
sum(AmountReporting), ADLegalEntity
from vendProvisionalBalanceTransTmp
group by AccountNum, PostingProfile, IsSummaryAccount, ADLegalEntity
where vendProvisionalBalanceTransTmp.AccountNum ==
vendProvisionalBalanceTmpProcessing.AccountNum
//&& vendProvisionalBalanceTransTmp.ADLegalEntity ==
vendProvisionalBalanceTmpProcessing.ADLegalEntity
&& vendProvisionalBalanceTransTmp.PostingProfile ==
vendProvisionalBalanceTmpProcessing.PostingProfile
&& vendProvisionalBalanceTransTmp.IsSummaryAccount ==
vendProvisionalBalanceTmpProcessing.IsSummaryAccount
&& vendProvisionalBalanceTransTmp.ADLegalEntity ==
vendProvisionalBalanceTmpProcessing.ADLegalEntity
&& vendProvisionalBalanceTransTmp.TransDate < _fromDate
{
vendProvisionalBalanceTmpValue.AccountNum =
vendProvisionalBalanceTmpProcessing.AccountNum;
vendProvisionalBalanceTmpValue.ADLegalEntity =
vendProvisionalBalanceTmpProcessing.ADLegalEntity;
vendProvisionalBalanceTmpValue.MainAccountId =
vendProvisionalBalanceTmpProcessing.MainAccountId;
vendProvisionalBalanceTmpValue.PostingProfile =
vendProvisionalBalanceTransTmp.PostingProfile;
vendProvisionalBalanceTmpValue.IsSummaryAccount =
vendProvisionalBalanceTransTmp.IsSummaryAccount;
vendProvisionalBalanceTmpValue.Amount =
vendProvisionalBalanceTransTmp.AmountAccounting;
vendProvisionalBalanceTmpValue.ReportingCurrencyAmount =
vendProvisionalBalanceTransTmp.AmountReporting;
//vendProvisionalBalanceTmpValue.insert();
tmpValueReporting.add(vendProvisionalBalanceTmpValue);
}
tmpValueReporting.insertDatabase();
No comments:
Post a Comment