0

I need to set up a column that will keep a running total of values. I have a program that automatically sets values for the columns in SharePoint. The program will overwrite the previous value within that column and I need a way of keeping a total from the previous and most up to date values.

I was thinking of setting up a calculated column that sums itself with the value of the updated column.

Is this possible with a calculated column? Would a workflow give me the capabilites I need?

2 Answers 2

1

As James has indicated, the calculated column can only work on data that currently exists in the current row, so the running total can't be done by a calculated column.

However, if I'm understanding you correctly, you could do this with two fields: - Field A - the field that your external program updates - default value of 0 - Field B - the field with the running total - default value of 0

Then you add an event receiver to the list. Any time an item in the list is created, you assign whatever is in Field A to Field B. I.e. B = A; Additionally, whenever an item in the list is updated, your event receiver can update the value of B. I.e., B = B + A;

You will want to be careful, because if a user has access to edit an item, they could edit Field B and screw up your totals.

0

The formula and idea you had will generate an infinite loop.

"total of values fed in automatically from an xml" - how do you mean?

The calculate column on works on data only from the current row.

1
  • I forgot that I'd need to set up a loop with a condition to that statement. I will rephrase the xml part of the question to better reflect what I need.
    – sange
    Commented Mar 4, 2011 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.