I'm taking a stab at keeping my reading diary in Org. I keep track of all the books I read, and some other facts about them, including whether they're fiction (F) or nonfiction (N).

So I would have a table something like the books table below, and I'd like to do some analysis on it and put the results in another table. I'd like to count how many books are of Type F and how many of Type N, and it looks like matching values with org-lookup-all (as explained in [1]) is the right way, but I can't get it to work.

I have this:

#+TBLNAME: books
| Title            | Author         | Type |
|------------------+----------------+------|
| NOS4A2           | Joe Hill       | F    |
| Gun Machine      | Warren Ellis   | F    |
| Carry On, Jeeves | P.G. Wodehouse | F    |
| Time Reborn      | Lee Smolin     | N    |

#+TBLNAME: analysis
| Fact              | Value |
|-------------------+-------|
| Fiction books     |     1 |
| Nonfiction  books |       |
#+TBLFM: $2@2='(length(org-lookup-all "F" '(remote(books,$3@2..$3@>)) nil))

The fiction count should be 3, not 1. Can anyone see what I'm doing wrong?

Thanks,

Bill

[1] http://orgmode.org/worg/org-tutorials/org-lookups.html

--
William Denton
Toronto, Canada
http://www.miskatonic.org/


Reply via email to