Running Balance on a field

hi all,
i’m quite new to NAV and i need to add a new column in the Vendor Ledger Entry Table to keep a running balance of the amount. i.e. “running balance” := “running balance” + amount … i need to do the same for the Item Ledger Entry on the Quantity field…

any help is highly appreciated :slight_smile: thanks and regards

Maria, welcome to forum!

If I understand your requirement correctly, its not the right place for such field. This table holds detailed entries and by design can’t contain summary data in detail lines.

It already EXISTS, but in different place - look at Balance field in Vedor List Form.

thanks for your quick reply!

i don’t know if i was clear enough but my main requirement is that when i open the ledger entries from the vendor card i get a field in the Vendor Ledger Entries Form which will show the running amount something similar to this (the bold column is the one i need to add):

Posting Date Document Type Document No. External Document No. Vendor No. Description Currency Code Original Amount Amount Running Balance Remaining Amount Due Date Pmt. Discount Date Pmt. Disc. Tolerance Date Original Pmt. Disc. Possible Remaining Pmt. Disc. Possible Max. Payment Tolerance Open On Hold Entry No.
20/06/2006 Invoice 40001740 CTCA04 Import -294.29 -294.29 -294.29 -294.29 20/06/2006 0 0 0 Yes 568089
22/07/2009 Invoice 3154 AEONIC/09/1137 CTCA04 Invoice 3157 USD -14,185.00 -14,185.00 -14,479.29 -14,185.00 22/07/2009 22/07/2009 22/07/2009 0 0 0 Yes 683782

do you think it is possible? i need to do the same for customer ledger entries and g/l entries … thanks a lot

sry the table didn’t fit here’s the column i need:

Amount Running Balance
-294.29 -294.29
-14,185.00 -14,479.29

This isn’t possible even theoretically, because you newer know the SORT ORDER of lines…

You may suggest lines will be sorted by Entry No, but even that doesn’t mean they are in historical order by Posting Date, so such Running Total makes no sense from Accounting view.

Instead, you may consider creating a Report, which shows you VLE, sorted first by Posting Date, then by Entry No, and add a field to this report as you described. Therefore, if someone inserts additional transactions, running the report again will reflect correct Running Total.

Hi Modris,

It is possible but is a lot of work on the server - may cause major performance issues. What you do is in the OnAfterGetCurrentRecord - copy the filters of the record variable REC to a variable and loop through the variable until current record totaling the value. Display the value in the list form.


I didn’t know about method you described - but it seems to be rather awkward way of going things… Theoretically it works, but practically, when there are thousands of records… IMHO serious performance loss is too high price for result gained.

Let’s better wait for next versions, when we will (?) be able to delegate such things to SQL Server - in TSQL this can be achieved with far less pain [:D]

Hi Modris,

Yes I have only put this in, in one site with low transaction levels and was a “Must Have” but preforms well.