4

The items in my org-mode file will have a number of properties relating to data points that I need to capture. In conjunction with this, I'd like to continue using C-c C-z to log notes tracking progress against each item.

The end goal is to get everything into column view, which will let me get the information into CSV format.

Column View seems to be primarily centred on the :PROPERTIES: drawer, plus a couple of other key attributes of an org headline (such as TODO keyword and Priority) but it doesn't seem like task notes/:LOGBOOK: is one of these.

xeijin
  • 101
  • 8
  • 1
    As far as I can tell the colum view allows to see a **fixed** number of elements per subtree. This contradicts the display of log-items the number of which typically increases as time goes by. I doubt that logbook items can be shown in column view in a satisfying way. – Marco Wahl May 11 '18 at 13:55
  • @MarcoWahl Anything is possible in Emacs :) – orgtre Jan 18 '23 at 02:07

2 Answers2

0

You can use CLOCKSUM in your columns definition, like so:

:PROPERTIES:
:COLUMNS: %25ITEM %CLOCKSUM
:END:

http://orgmode.org/manual/Special-properties.html

tsupe
  • 101
  • That would only give me clocking data, not the notes on my task and status changes that currently get inserted into the :LOGBOOK: drawer – xeijin Nov 10 '17 at 14:20
0

You can do this by setting org-columns-modify-value-for-display-function, but you'd have to parse the logbook yourself.

Say you have an Org file looking like this:

:PROPERTIES:
:COLUMNS:       %20ITEM %TODO %PROP1 %TSNOTE1 %NOTE1
:END:

* TODO task 1
:PROPERTIES:
:PROP1:     val1
:END:
:LOGBOOK:
- Note taken on [2023-01-17 Tue 21:16] \\
  My second note.
- Note taken on [2023-01-17 Tue 21:15] \\
  My first note.
:END:

* TODO task 2
:PROPERTIES:
:PROP1:     val1
:END:
:LOGBOOK:
- Note taken on [2023-01-17 Tue 02:20] \\
  A more recent note.
- Note taken on [2023-01-17 Tue 02:19] \\
  Another note.
:END:

Then the following code will show the timestamp and first line of the most recent logbook note in the columns TSNOTE1 and NOTE1:

(defun my-column-display-value-transformer (column-title value)
  "Modifies the value to display in column view."
  (when (and (member column-title '("TSNOTE1" "NOTE1"))
             (org-back-to-heading)
             (re-search-forward
              "Note taken on \\[\\(.*\\)\\] \\\\\\\\\\\n +\\(.*\\) *$"
              (org-entry-end-position) t))
    (if (equal column-title "TSNOTE1")
        (match-string-no-properties 1)
      (match-string-no-properties 2))))

(setq org-columns-modify-value-for-display-function
      #'my-column-display-value-transformer)

After enabling column view (M-x org-columns) it will look like this: enter image description here

orgtre
  • 1,012
  • 4
  • 15