Reputation: 709
have a simple list with column Name and Price. I've inserted values:
Name | Price
-------------
A | 3
-------------
B | 30
I need to get the maximum of all Price values inserted before to make a check if price in inserted record is bigger than existing maximum (something like auction).
But =Price>MAX(Price) isn't working, cause it is checking only existing record. Is there ane agregation functions for my task?
Upvotes: 0
Views: 2054
Reputation: 456
The SharePoint Formula works only on the Current Item values. So you can't get the MAX price of all the item in the list in a formula. You need to do that whith Programmation :
Event receiver : ItemAdding (using SharePoint Object Model Server side)
Or
JavaScript : override the PreSaveAction() function, to get the Max price and check with your value
Upvotes: 1
Reputation: 29
SPListItem maxID = (from x in listCollection select x).Max();
This should work
Upvotes: 0