user797257
user797257

Reputation:

Org-mode sum times in a table

I read about properties in org-mode tables, but either something is broken, or I cannot understand how to use them. Here's what I've tried:

:PROPERTIES:
:COLUMNS: %10item %10start(start){:} %10end(end){:} %10total(total)
:END:
|   | start |   end | total |
|---+-------+-------+-------|
|   |  9:30 | 18:45 |  1:10 |
|   |  9:30 | 18:45 |  1:10 |
|   |  9:30 | 18:45 |  1:10 |
|   |  9:30 | 18:45 |  1:10 |
|   |  9:30 | 18:45 |  1:10 |
|   |  9:30 | 18:45 |  1:10 |
|   |  9:30 | 18:45 |  1:10 |
|---+-------+-------+-------|
|   |       |       |  7:10 |
#+TBLFM: @2$4..@-1$4=$3-$2::@>$4=vsum(@2$4..@-1$4)

The result is obviously absolutely not what I'd expect. I don't think that the properties part actually does anything. The result is the same with or without it. Putting it here only to show what I've tried.

Upvotes: 11

Views: 2738

Answers (2)

Michael
Michael

Reputation: 1522

The org-mode property COLUMNS is not about tables, it's about column views (see http://orgmode.org/manual/Column-view.html).

What the column view does, is overlaying the buffer with a table. That table displays the values of the node's properties and its children's properties.

You can find an example with screenshots in the Org Mode Community.

Upvotes: 0

user797257
user797257

Reputation:

OK, I've found it here: http://orgmode.org/worg/org-hacks.html

The answer was I had to append ;T after the formula, i.e. the final table looks like this:

| start |   end |    total |
|-------+-------+----------|
|  9:30 | 18:45 | 09:15:00 |
|  9:30 | 18:45 | 09:15:00 |
|  9:30 | 18:45 | 09:15:00 |
|  9:30 | 18:45 | 09:15:00 |
|  9:30 | 18:45 | 09:15:00 |
|  9:30 | 18:45 | 09:15:00 |
|  9:30 | 18:45 | 09:15:00 |
|-------+-------+----------|
|       |       | 64:45:00 |
#+TBLFM: @2$3..@-1$3=$2-$1;T::@>$3=vsum(@2$3..@-1$3);T

But I'd still like to know what do those properties do (if at all).

Upvotes: 14

Related Questions