4

Context As far as I know it is possible to define properties for a section in a PROPERTIES drawer like this:

* Introduction
:PROPERTIES:
:PlannedPages: 0.5
:ActualPages: 0.5
:END:

You can see that there are two properties, that should reflect the number of pages that I plan to write for this section and the number of pages that I actually wrote.

Question Do you know an example that shows to some extent how to program a dynamic block similiar to CLOCKTABLE which maintains a table that contains sections in it's rows and the values of some properties in it's columns?

:DOCUMENTSCOPE: 
|                   | Planned | Actual |
| Section           |   Pages | Pages  |
|-------------------+---------+--------|
| Introduction      |     0.5 |        |
| Background        |       2 |        |
| Thesis objectives |       1 |        |
| Time schedule     |     0.5 |        |
:END:
  • I found org-collector but it gives an 'Before first headline' error, also it's currently not supporting indentation according to the headline level and is printing escape characters in headlines :/ – Christoph May 15 '15 at 13:28
4

The columnview dynamic block does this:

 #+BEGIN: columnview :hlines 1 :id global
 | ITEM            | PlannedPages | ActualPages |
 |-----------------+--------------+-------------|
 | * first section |            7 |           3 |
 |-----------------+--------------+-------------|
 | * Introduction  |          0.5 |         0.5 |
 #+END:

C-c C-c on the #+BEGIN: line will update the block. The option :id global makes is collect the whole file, :id local would collect only that entry.


Minimal example:

#+TITLE: Page planning example
#+COLUMNS: %25ITEM %4PlannedPages(Planned pages){+} %4ActualPages(Actual pages){+}
#+PROPERTY: ActualPages_All "" 0.25 0.5 1 1.5 2
#+PROPERTY: PlannedPages_ALL "" 0.25 0.5 1 1.5 2

#+BEGIN: columnview :hlines 0 :id global :maxlevel 1
| ITEM           | Planned pages | Actual pages |
|----------------+---------------+--------------|
| * Introduction |           1.5 |              |
| * Main part    |           3.5 |              |
| * Conclusions  |           0.5 |              |
#+END

* Introduction
  :PROPERTIES:
  :PlannedPages: 1.5
  :END:
* Main part
  :PROPERTIES:
  :PlannedPages: 3.5
  :END:
** Section 1
   :PROPERTIES:
   :PlannedPages: 2
   :END:
** Section 2
   :PROPERTIES:
   :PlannedPages: 1.5
   :END:
* Conclusions
  :PROPERTIES:
  :PlannedPages: 0.5
  :END:
  • Hello Erik, thank you for your answer. I looked again into it and found the editing features very nice. I did not know them before and did not see an advantage of the column view. I have added a minmal example. – Christoph Jun 1 '15 at 12:27
  • The only issue with this minimal example is that the allowed values for ActualPages are not recognized. Do you see a reason for this? – Christoph Jun 1 '15 at 12:28
  • For single level tables this solution is fine. Is there a possibility to adapt the column view similiar to the clock table such that it indent's children and strips tags and todo's from the Item column? – Christoph Jun 1 '15 at 12:35
  • 1
    I don't see any obvious way to indent the table by level or modify how things are displayed beyond what COLUMNS does normally. – erikstokes Jun 2 '15 at 1:14
  • In org-mode release 9.0 there is a new parameter :indent introduced: orgmode.org/Changes_old.html Unfortunately in contrast to clock tables there is no function similar to org-clocktable-indent-string that could be overriden but a hard-coded constant in org-dblock-write:columnview instead. – Christoph Oct 16 '18 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.