SharePoint 2013 list - calculated column - max value per column per category +1

Dear Forum,

i'm trying to create a column that calculates an ID for a row based on the category where a row is assigned. The ID which is a numerical value (increasing integer) is calculated for a new row of a specific category on the basis of the IDs already used for the other rows of this category.

So the input for the formula would be column "category" (with eg. "a", "b" or "c") and maximum value of column ID in the rows where category corresponds to the category of the new row.

Please compare the following example:

Row number Category ID
1 a 1
2 b 1
3 b 2
4 c 1
5 a 2
6 b 3

In the above example the next IDs per category would be a - 3, b - 4 and c - 2 and so on.

I hope that the description is quite clear and i'm looking forward to your feedback how this could be implemented.

Thank you and kind regards

Philipp


  • Edited by PhilippH Thursday, July 30, 2015 8:07 AM unused html-code
July 30th, 2015 7:43am

AFAIK calculated columns allow information from a 'row' to be used in the math, but not to look up a 'column' domain.

Mike B

Free Windows Admin Tool Kit Click here and download it now
August 1st, 2015 7:58am

I would recommend to follow below steps:

1. Create a column say MaxID of number type default to 0.

2. Write an event receiver on item updated, now check if the current category exist.

if yes or no, try to get top 1 item's MaxID and increment it by one and update the MaxID field.

Let me know in case need a code sample.

August 1st, 2015 8:16am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics