Schedule grouped by tag

I am looking for a way to use time tracking information from org-mode agenda files to schedule. The time spent in different tasks will be indicated, grouped by tag and limited to a given time frame, sort of like a dynamic block with a clock frequency, but grouped by tag instead of file / category / header.

For example, if my agenda contains the following data (possibly scattered between different files):

* TODO project 1 ** TODO task 1 :tag1: :LOGBOOK: CLOCK: [2013-06-27 Thu 18:00]--[2013-06-27 Thu 19:04] => 1:04 CLOCK: [2013-06-26 Wed 17:00]--[2013-06-26 Wed 17:32] => 0:32 :END: ** TODO task 2 :tag2: :LOGBOOK: CLOCK: [2013-06-27 Thu 17:00]--[2013-06-27 Thu 18:00] => 1:00 CLOCK: [2013-06-27 Thu 15:00]--[2013-06-27 Thu 15:50] => 0:50 :END: * TODO project 2 :tag2: :LOGBOOK: CLOCK: [2013-06-27 Thu 19:04]--[2013-06-27 Thu 21:00] => 1:56 CLOCK: [2013-06-27 Thu 15:50]--[2013-06-27 Thu 17:00] => 1:10 :END: 

I would like to get the following results:

 #+BEGIN: clocktable-by-tag :maxlevel 2 :tags ("p1" "p2") :tstart "2013-06-27" :tend "2013-06-28" | Tag | Headline | Time | | |------+-----------------+--------+------| | tag1 | *Tag time* | *1:04* | | | | TODO project 1 | 1:04 | | | | \__ TODO task 1 | | 1:04 | |------+-----------------+--------+------| | tag2 | *Tag time* | *4:56* | | | | TODO project 1 | 1:50 | | | | \__ TODO task 2 | | 1:50 | | | TODO project 2 | 3:06 | | #+END: 

Is there a standard way to do this with org? If not, I'm going to cycle through files and tags using org-get-table-data to collect synchronization information; would there be another, more efficient way to do something?

+6
source share
1 answer

Here is what I came up with: https://gist.github.com/ffevotte/5899058

It is not very optimized, but it seems to do the job and should support most of the arguments to the dynamic clocktable block.

Sample (anonymous) output in my real org agenda files:

 #+BEGIN: clocktable-by-tag :tags ("p_f3c" "p_sc") :tstart "2013-01-01" :tend "2013-05-19" :maxlevel 2 | Tag | Headline | Time (h) | | | | | | <r> | | | |-------+------------------------------+----------+-------+------| | p_f3c | *Tag time* | *18.42* | | | | | File *xxx.org* | 18.42 | | | | | . xxxxxxxxxxxxxxxxxxx | | 13.03 | | | | . \__ xxxxxxxxxxxxx | | | 7.78 | | | . \__ xxxxxxxxxxxxxxxxxxxxx | | | 3.98 | | | . xxxxxxxxxxxxxxxxxx | | 5.38 | | | | . \__ xxxxxxxxxxxxxxx | | | 5.38 | |-------+------------------------------+----------+-------+------| | p_sc | *Tag time* | *18.90* | | | | | File *yyyy.org* | 4.42 | | | | | . xxxxxxxxxxxxxxxxxxxxxx | | 2.83 | | | | . xxxxxxxxxxxxxxxxxx | | 1.58 | | | | . \__ xxxxxxxxxxxxxxxxxxxxxx | | | 1.58 | | | File *todo.org* | 14.48 | | | | | . xxxxxxxxxxxxxxxx | | 14.48 | | | | . \__ xxxxxxxxxxx | | | 2.00 | | | . \__ xxxxxxxxxxxxx | | | 8.48 | | | . \__ xxxxx | | | 4.00 | #+END: 
+9
source

Source: https://habr.com/ru/post/948277/


All Articles