This topic is locked

Running Sum

11/9/2006 11:40:21 AM
ASPRunnerPro General questions
B
bsiinc author

Is there a way to add a column which contains a running sum of a field in one of my tables? I have a table which shows inventory items and I need to show how each row affects the balance of an item left in inventory.

Sergey Kornilov admin 11/10/2006

Here is how you can do this:

  1. In ListOnLoad event put the following:
    Sub ListOnLoad()

    '** Custom code ****

    ' put your custom code here
    Session("Sum")=0
    End Sub


2. Set View as type of that field to Custom. Put the following code there:

Session("Sum") = Session("Sum") + CDbl(strValue)

strValue = Session("Sum")