You are on page 1of 2

Vertical Solutions Info Share

Duplicate Budgets / Budgets Not saving.


You might come across a scenario where you try to capture and save budgets on Evolution
and the budget amount you enter keeps changing to some other amount.
Cause and Solution
This is caused by duplicate budget records in the _etblbudgets table.
For any budgets period an accountlink should have one record, ie accountlink 112 will have
one budget entry in period 9.
As you can see below the iBudgetAccountID 1641 has more than one record in Budget
period 19 and 20:

To fix this:
The script below will find and delete duplicated budget records. Once this is done these
budgets will need to be recaptured:
delete from _etblBudgets
where idBudgets not in
(
select idBudgets from
(
select idBudgets = min(B.idBudgets), B.iBudgetAccountID,
B.iBudgetProjectID, B.iBudgetPeriodID, B.iBudgetTxBranchID
from _etblBudgets B
left join (
select iBudgetAccountID, iBudgetProjectID,
iBudgetPeriodID, iBudgetTxBranchID, [count] = count(*)
from _etblBudgets
group by iBudgetAccountID, iBudgetProjectID,
iBudgetPeriodID, iBudgetTxBranchID
having count(*) > 1
) DUPL -- Duplicates
on DUPL.iBudgetAccountID = B.iBudgetAccountID
and DUPL.iBudgetProjectID = B.iBudgetProjectID
and DUPL.iBudgetPeriodID = B.iBudgetPeriodID
and DUPL.iBudgetTxBranchID = B.iBudgetTxBranchID
group by B.iBudgetAccountID, B.iBudgetProjectID, B.iBudgetPeriodID,
B.iBudgetTxBranchID
) EXCL -- Exclude List
)

Please not that this script is for Version 7, 7.00.207, and might not work on older
version due to table and field name references.

You might also like