[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to retrieve ALL the information of an Org table ?

From: Emmanuel Charpentier
Subject: How to retrieve ALL the information of an Org table ?
Date: Sat, 09 Oct 2021 22:36:17 +0200
User-agent: Evolution 3.42.0-2

Dear list,
I have problems with exploiting programatically the structure of an Org table :
I want to write function acting on complex tables, where the original information is presented along various statistics. My idea is to isolate the original information in a range delimited (by convention) by the first and second hlines and by the first and last columns ; the function should accept the whole table and retrieve the original data. The point is that the function should accept a variable number of lines in both the "original data" range and the summary information.
Let ttest such a table with hlines :
#+name: ttest
| ttest | c1 | c2 | rSum |
|     3 |  3 |  5 |    8 |
|     8 |  8 | 12 |   20 |
|  cSum | 11 | 17 |   28 |
#+TBLFM: @>$2..@>$>=vsum(@I..@II)::@2..@>>$4=vsum($<<..$>>)
Passing this table as an argument to source code loses the hlines :
#+begin_src emacs-lisp :exports results :results drawer :var foo=ttest
((ttest c1 c2 rSum) (3 3 5 8) (8 8 12 20) (cSum 11 17 28))
The structure allowing to retrieve the original data is lost.
The point is that the source code can't exploit the hlines to find relevant information (in the present case, the lines between the hlines).
Alternatively, one may try and pass the relevant range, using foo=(org-table-get-remote-range "ttest" "@I$<<..@II$>>") as an argument. This fails for a different reason :
#+begin_src emacs-lisp :exports results :results drawer :var foo=(org-table-get-remote-range "ttest" "@I$<<..@II$>>")
(3 5 8 12)
Again, the structure is lost : this time, foo is a "flattened" vector, whose matricial shape is lost to the processing function.
I am looking for explanations and/or hints.

Attached : the source of the present mail.

Thanks in advance...

Emmanuel Charpentier

Attachment: TstTableRange.org
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]