emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* help: howto aggregate several properties in one column
@ 2024-08-11  8:49 Pedro
  2024-08-11 20:27 ` tbanelwebmin
  0 siblings, 1 reply; 4+ messages in thread
From: Pedro @ 2024-08-11  8:49 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1.1: Type: text/plain, Size: 4193 bytes --]

Hi,

I am a heavy user of propview [1] and I am very happy with it, but looks 
like now I reached a limitation, or maybe someone founds a magical 
workaround. I am open to use another solution outside of propview.

Find attached in file aggregate-props.org that serves as a playground 
environment and as an example of what I am struggling with, it is posed 
as a generic example: I want to "merge" two properties into one, no 
matter if the property exists or no. I am trying to use concat, concat 
works only when the properties on an item exist, if one of them does not 
exist, fails, which is unfortunate to what I am trying to achieve, 
because on one side, I would like to report (with a propview table) the 
frequency of appearance of each test_a, test_b, test_c, etc. on all 
nodes with tag :test:, and with another propview table, a summary of all 
test properties.

There is a workaround based on a precalculation strategy that I kind of 
hate: do an org-map-entries of all targeted items with tag "test", and 
update SUMMARY property through an adhoc elisp function all the 
properties related to test (I am happy with just enumerating all of the 
involved subproperties, but I recognize, having a regex on property such 
as test_* or that "starts with" test, would be amazing), then, it is 
just as easy as adding the new column SUMMARY, but I would like to avoid 
this solution

Extra note: related to propview, it is not a problem to concat 100 
elements, because you can do it in an extra shortnamed function, so the 
column name can be short

So this is what happens, concat of TEST_A and TEST_B is 0

#+BEGIN: propview :scope tree :match "+test" :noquote all :cols (ITEM 
CREATED TEST_A TEST_B (concat TEST_A TEST_B) (concat TEST_C TEST_D))
| ITEM    | CREATED                | TEST_A | TEST_B | (concat TEST_A 
TEST_B) | (concat TEST_C TEST_D) |
|---------+------------------------+--------+--------+------------------------+------------------------|
| mytest  | [2024-08-09 Fri 23:53] |      a |      0 
|                      0 | cd                     |
| mytest2 | [2024-08-09 Fri 23:53] |      0 |      b 
|                      0 | cd                     |
| mytest3 | [2024-08-09 Fri 23:53] |      0 |      0 
|                      0 | 0                      |
|---------+------------------------+--------+--------+------------------------+------------------------|
|         |                        |        | |                        
|                        |
#+END:

What I would expect to happen is that in the concat result of TEST_A and 
TEST_B would appear a or b, maybe that could be done with another function?

#+BEGIN: propview :scope tree :match "+test" :noquote all :cols (ITEM 
CREATED TEST_A TEST_B (concat TEST_A TEST_B) (concat TEST_C TEST_D))
| ITEM    | CREATED                | TEST_A | TEST_B | (concat TEST_A 
TEST_B) | (concat TEST_C TEST_D) |
|---------+------------------------+--------+--------+------------------------+------------------------|
| mytest  | [2024-08-09 Fri 23:53] |      a |      0 
|                      a | cd                     |
| mytest2 | [2024-08-09 Fri 23:53] |      0 |      b 
|                      b | cd                     |
| mytest3 | [2024-08-09 Fri 23:53] |      0 |      0 
|                      0 | 0                      |
|---------+------------------------+--------+--------+------------------------+------------------------|
|         |                        |        | |                        
|                        |
#+END:

Cheers,
pedeb

[1] https://orgmode.org/worg/org-contrib/org-collector.html


[-- Attachment #1.1.2: aggregate-props.org --]
[-- Type: text/org, Size: 1823 bytes --]

* my test
:PROPERTIES:
:CREATED:  [2024-08-10 Sat 13:48]
:END:

#+BEGIN: propview :scope tree :match "+test" :noquote all :cols (ITEM CREATED TEST_A TEST_B (concat TEST_A TEST_B) (concat TEST_C TEST_D))
| ITEM    | CREATED                | TEST_A | TEST_B | (concat TEST_A TEST_B) | (or TEST_A TEST_B) | (or TEST_B TEST_A) | (concat TEST_C TEST_D) |
|---------+------------------------+--------+--------+------------------------+--------------------+--------------------+------------------------|
| mytest  | [2024-08-09 Fri 23:53] |      a |      0 |                      0 |                  a |                  0 | cd                     |
| mytest2 | [2024-08-09 Fri 23:53] |      0 |      b |                      0 |                  0 |                  b | cd                     |
| mytest3 | [2024-08-09 Fri 23:53] |      0 |      0 |                      0 |                  0 |                  0 | 0                      |
|---------+------------------------+--------+--------+------------------------+--------------------+--------------------+------------------------|
|         |                        |        |        |                        |                    |                    |                        |
#+END:

** mytest                                                                      :test:
:PROPERTIES:
:CREATED:  [2024-08-09 Fri 23:53]
:CUSTOM_ID: board_157
:test_a:    a
:test_c:    c
:test_d:    d
:END:

** mytest2                                                                     :test:
:PROPERTIES:
:CREATED:  [2024-08-09 Fri 23:53]
:CUSTOM_ID: board_158
:test_b:    b
:test_c:    c
:test_d:    d
:END:

** mytest3                                                                     :test:
:PROPERTIES:
:CREATED:  [2024-08-09 Fri 23:53]
:CUSTOM_ID: board_158
:test_c:    c
:END:

[-- Attachment #1.1.3: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3325 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread
* help: howto aggregate several properties in one column
@ 2024-08-10 12:13 Pedro
  0 siblings, 0 replies; 4+ messages in thread
From: Pedro @ 2024-08-10 12:13 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1.1: Type: text/plain, Size: 4191 bytes --]

Hi,

I am a heavy user of propview [1] and I am very happy with it, but looks 
like now I reached a limitation, or maybe someone founds a magical 
workaround. I am open to use another solution outside of propview.

Find attached in file aggregate-props.org that serves as a playground 
environment and as an example of what I am struggling with, it is posed 
as a generic example: I want to "merge" two properties into one, no 
matter if the property exists or no. I am trying to use concat, concat 
works only when the properties on an item exist, if one of them does not 
exist, fails, which is unfortunate to what I am trying to achieve, 
because on one side, I would like to report (with a propview table) the 
frequency of appearance of each test_a, test_b, test_c, etc. on all 
nodes with tag :test:, and with another propview table, a summary of all 
test properties.

There is a workaround based on a precalculation strategy that I kind of 
hate: do an org-map-entries of all targeted items with tag "test", and 
update SUMMARY property through an adhoc elisp function all the 
properties related to test (I am happy with just enumerating all of the 
involved subproperties, but I recognize, having a regex on property such 
as test_* or that "starts with" test, would be amazing), then, it is 
just as easy as adding the new column SUMMARY, but I would like to avoid 
this solution

Extra note: related to propview, it is not a problem to concat 100 
elements, because you can do it in an extra shortnamed function, so the 
column name can be short

So this is what happens, concat of TEST_A and TEST_B is 0

#+BEGIN: propview :scope tree :match "+test" :noquote all :cols (ITEM 
CREATED TEST_A TEST_B (concat TEST_A TEST_B) (concat TEST_C TEST_D))
| ITEM    | CREATED                | TEST_A | TEST_B | (concat TEST_A 
TEST_B) | (concat TEST_C TEST_D) |
|---------+------------------------+--------+--------+------------------------+------------------------|
| mytest  | [2024-08-09 Fri 23:53] |      a |      0 
|                      0 | cd                     |
| mytest2 | [2024-08-09 Fri 23:53] |      0 |      b 
|                      0 | cd                     |
| mytest3 | [2024-08-09 Fri 23:53] |      0 |      0 
|                      0 | 0                      |
|---------+------------------------+--------+--------+------------------------+------------------------|
|         |                        |        | |                        
|                        |
#+END:

What I would expect to happen is that in the concat result of TEST_A and 
TEST_B would appear a or b, maybe that could be done with another function?

#+BEGIN: propview :scope tree :match "+test" :noquote all :cols (ITEM 
CREATED TEST_A TEST_B (concat TEST_A TEST_B) (concat TEST_C TEST_D))
| ITEM    | CREATED                | TEST_A | TEST_B | (concat TEST_A 
TEST_B) | (concat TEST_C TEST_D) |
|---------+------------------------+--------+--------+------------------------+------------------------|
| mytest  | [2024-08-09 Fri 23:53] |      a |      0 
|                      a | cd                     |
| mytest2 | [2024-08-09 Fri 23:53] |      0 |      b 
|                      b | cd                     |
| mytest3 | [2024-08-09 Fri 23:53] |      0 |      0 
|                      0 | 0                      |
|---------+------------------------+--------+--------+------------------------+------------------------|
|         |                        |        | |                        
|                        |
#+END:

Cheers,
pedeb

[1] https://orgmode.org/worg/org-contrib/org-collector.html

[-- Attachment #1.1.2: aggregate-props.org --]
[-- Type: text/org, Size: 1823 bytes --]

* my test
:PROPERTIES:
:CREATED:  [2024-08-10 Sat 13:48]
:END:

#+BEGIN: propview :scope tree :match "+test" :noquote all :cols (ITEM CREATED TEST_A TEST_B (concat TEST_A TEST_B) (concat TEST_C TEST_D))
| ITEM    | CREATED                | TEST_A | TEST_B | (concat TEST_A TEST_B) | (or TEST_A TEST_B) | (or TEST_B TEST_A) | (concat TEST_C TEST_D) |
|---------+------------------------+--------+--------+------------------------+--------------------+--------------------+------------------------|
| mytest  | [2024-08-09 Fri 23:53] |      a |      0 |                      0 |                  a |                  0 | cd                     |
| mytest2 | [2024-08-09 Fri 23:53] |      0 |      b |                      0 |                  0 |                  b | cd                     |
| mytest3 | [2024-08-09 Fri 23:53] |      0 |      0 |                      0 |                  0 |                  0 | 0                      |
|---------+------------------------+--------+--------+------------------------+--------------------+--------------------+------------------------|
|         |                        |        |        |                        |                    |                    |                        |
#+END:

** mytest                                                                      :test:
:PROPERTIES:
:CREATED:  [2024-08-09 Fri 23:53]
:CUSTOM_ID: board_157
:test_a:    a
:test_c:    c
:test_d:    d
:END:

** mytest2                                                                     :test:
:PROPERTIES:
:CREATED:  [2024-08-09 Fri 23:53]
:CUSTOM_ID: board_158
:test_b:    b
:test_c:    c
:test_d:    d
:END:

** mytest3                                                                     :test:
:PROPERTIES:
:CREATED:  [2024-08-09 Fri 23:53]
:CUSTOM_ID: board_158
:test_c:    c
:END:

[-- Attachment #1.1.3: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3323 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-12  9:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-11  8:49 help: howto aggregate several properties in one column Pedro
2024-08-11 20:27 ` tbanelwebmin
2024-08-12  8:46   ` Pedro
  -- strict thread matches above, loose matches on Subject: below --
2024-08-10 12:13 Pedro

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).