Question

I have a SharePoint list which all has a unique ID to identify the items, so I want to create a calculated column that counts how many ID are there, like a count!

Any help is appreciated

Was it helpful?

Solution

  1. The ID field is usually automatically assigned by the system. As long as you don't delete an entry, the new ID number shows how much entry you have.

  2. A calculated field is "calculated" only when you edit/save the entry. It would not automatically re-calculate. Assume you have a way to get the total number of entries, the total number of entries stored in the current entry would not be automatically updated if you add more entries later on.

  3. Or you have to do one or more workflow, so that when one entry is added to the list, the workflow would run on every entry to update the count field for each entry. (one workflow to update the count field when the entry is updated, another workflow, defined with a different list to find the next not updated entry and trigger a change of it, stop when all entry updated)

add comments if you need more details on #3

On #3, there are two topics, A. To get the count of total entry numbers B. To update the counted number on the field (e.g. "count") of the list.

About A. I think we can do this with CAML query. Check link here, and this one for example. Or e.g. in Nintex workflow, simply do a "Query list" to get a collection of the ID field, and "Collection operation" with count. Collection operation

About B. Say we are working with list X, and we define a "control" list called Y. At each creation/modification of entry of X, we trigger a workflow Wx, which is just to update a whatever field defined entry in list Y, just to trigger Wy.

At each modification of entry of Y, we trigger a workflow Wy, which is to do the count of entries in list X, find an entry in list X, of which the "count" doesn't match the new count number, and update that entry in X with the new count number, and stop the Wy, but because of the entry in X is updated, the Wy will be triggered again.

In Wy, you will have to add logic/condition to stop the workflow Wy when there's no X entry found, to avoid infinitive loop.

By the way "count" field in X here is not a calculated field, but just a number field.

OTHER TIPS

You can't, calculated columns only operate on the current item. You could create a grouped view and use the Totals section to add a count to a field.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top