开发者

Adding up the item values in a list with Emacs/Org-Mode

Is it possible to add up values in a list so the value next to 'Items Total' is the sum of all the sum items? Something like -

* Items Total [10]
** Items 1 [1]
** Items 2 [5]
** Items 3 [4]
开发者_Go百科

Or if you have some other way of get the sum of values in org-mode I'd be glad to hear it.


I think the only way to do that is using a table instead of a list. Tables let you perform complex math on columns/rows/etc and are basically a mini-spreadsheet.


There is another way to do it where you mention keep the index as a property and enable the column mode view. A typical part of my document would look like this

* Heading 1 
:PROPERTIES: 

:COLUMNS: %DURATION{+}

** Heading 2
SCHEDULED: <2011-05-02 Mon 10:00>
   :PROPERTIES:
   :PEOPLE:   Shyam, Archana, Santosh
   :DURATION: 2 hours
   :END:
   - Architecture Description
   - Register Set Description
   - Issues Discussion 

** Heading 2 Part 1
SCHEDULED: <2011-05-02 Mon 10:00>
   :PROPERTIES:
   :PEOPLE:   Shyam, Archana, Santosh
   :DURATION: 4 hours
   :END:
   - Design and Architecture
   - Issues Discussion 

With the above section in an org mode buffer, C-c C-x C-c enables the Column view and you can see the DURATION property showing up the sum of the Durations for Heading2 and Heading2 Part 2 which is 6 hours.

More info here http://orgmode.org/manual/Column-attributes.html#Column-attributes

Thanks Shyam

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜