tbanel / orgtbljoin

Enrich an Org-table with a reference table
GNU General Public License v3.0
32 stars 4 forks source link

Problem with (org-update-all-dblocks)+org-table-iterate-buffer-tables+join+aggregate, #2

Closed ouboub closed 2 years ago

ouboub commented 2 years ago

It seems that is a problem with (org-update-all-dblocks)+org-table-iterate-buffer-tables+join+aggregate, in the case, the constructed table contains constructions such as :formula "@1$6=Final"

The error message has the form

The problem is caused by the :formula entry, since (org-update-all-dblocks) deletes it.

The only workaround is not to use :formula "@1$6=Final

But to have the entry Final in an empty column in one of the tables.

Not sure who is here the culprit. Should one submit a bug report for (org-update-all-dblocks)?

Uwe Brauer

(org-update-all-dblocks)
(org-table-iterate-buffer-tables)

Set up the final result

The total columns

#+Name: e1-tot
| DNI    | E1Tot |
|--------+-------|
| 1234** |     28 |
| 7890** |     2 |
#+END:

#+Name: e2-tot
| DNI    | E2Tot |
|--------+-------|
| 1234** |     9 |
| 7890** |     0 |
#+END:

#+Name: c1-tot
| DNI    | C2 |
|--------+----|
| 1234** | 99 |
| 7890** | 99 |
#+END:

#+Name: c1-tot-mod
| DNI    | C2 | Final |
|--------+----+-------|
| 1234** | 88 |       |
| 7890** | 88 |       |
#+END:

#+Name: may-22-a
#+BEGIN: join :mas-table e1-tot :mas-column "DNI" :ref-table e2-tot  :ref-column "DNI" :formula "@1$4=ResMay22"
| DNI    | E1Tot | E2Tot |     |
|--------+-------+-------+-----|
| 1234** |    28 |     9 | 3.7 |
| 7890** |     2 |     0 | 0.2 |
#+TBLFM: $4=($2+$3)/10::@1$4=ResMay22
#+END:

#+Name: may-22-final
#+BEGIN: join :mas-table may-22-a :mas-column "DNI" :ref-table c1-tot  :ref-column "DNI" 
| DNI    |   | E1Tot | E2Tot | ResMay22 | C2 | Final |
|--------+---+-------+-------+----------+----+-------|
| 1234** |   |    28 |     9 |      3.7 | 99 |  14.0 |
| 7890** |   |     2 |     0 |      0.2 | 99 |  10.1 |
#+TBLFM: $7=vsum($3..$6)/10;f1::@1$5=ResMay22::@1$7=Final
#+END:

#+Name: may-22-final-mod
#+BEGIN: join :mas-table may-22-a :mas-column "DNI" :ref-table c1-tot-mod  :ref-column "DNI" 
| DNI    | E1Tot | E2Tot |     | C2 | Final |
|--------+-------+-------+-----+----+-------|
| 1234** |    28 |     9 | 3.7 | 88 |  12.9 |
| 7890** |     2 |     0 | 0.2 | 88 |   9.0 |
#+TBLFM: $6=vsum($2..$5)/10;f1
#+END:

workaround
# 
#+BEGIN: aggregate :table may-22-final :cols "DNI Final"
| DNI    | Final |
|--------+-------|
| 1234** |  14.0 |
| 7890** |  10.1 |
#+END:
tbanel commented 2 years ago

The bug was fixed in late July. I forgot to mention it here. The issue is closed.