Sum specific list items and assign the sum value into a different list

Alright, here's my scenario :

I have 2 custom lists : Orders and Items . The Items list contains a field Description (text) and a Amount Per Item field (calculated). The Orders list contains a Total amount field and a Items field (lookup on the description field in items which allows multiple values selection).

Here's a more visual explanation :

  • Orders

  • Total amount
  • Items (lookup on the description field in items which allows multiple values selection)
  • Items

  • Description (text)
  • Amount per Item
  • I would like to do the sum of the Amount per Item field of the selected items from the Items lookup field from Orders and put the value of the sum in the total amount field in Orders

    Any suggestions? Is it possible to do this in SharePoint 2010 without code? If not, could you show what the code would look like?

    Thanks.


    你可以试试

    OrderList.Total = OrderList.Items.Sum(item => item.AmountPerItem);
    
    链接地址: http://www.djcxy.com/p/64140.html

    上一篇: 如何在CAML Query中执行double orderby?

    下一篇: 总结特定列表项并将总和值分配到不同的列表中