emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Tables for attendance lists - A problem understanding TBLFM?


From: Gunnar Wolf
Subject: Re: [O] Tables for attendance lists - A problem understanding TBLFM?
Date: Tue, 9 Apr 2013 09:55:09 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

Nick Dokos dijo [Mon, Apr 08, 2013 at 11:31:14PM -0400]:
> You can turn on formula debugging with C-c { and then you'd
> see that in Pancho's case, the list is ("") i.e. a list containing the
> empty string - a list of length 1. That might qualify as a bug (or not) but
>  
> you can easily work around it, using (delq "" list) which deletes empty
> strings from the list.

Ok - I was not sure on how to use/interpret the debugging facility,
but it will surely help me

> Try this:
> 
> #+CAPTION: Attendances for April
> |---------+-------------------+---+---+---+---+----+-------|
> | Account | Name              | 1 | 3 | 5 | 8 | 10 | Total |
> |---------+-------------------+---+---+---+---+----+-------|
> |    1234 | Cárdenas, Lázaro  | X |   | X | X |    |     3 |
> |    5678 | Madero, Francisco | X | X | X | X |    |     4 |
> |    1544 | Villa, Pancho     |   |   |   |   |    |     0 |
> |    0113 | Zapata, Emiliano  |   | X | X |   |    |     2 |
> |---------+-------------------+---+---+---+---+----+-------|
> #+tblfm: @II+1$>address@hidden>='(length (delq "" '($<<<..$>>)))

Interesting, my org-mode version behaves differently, and still gives
'1' for the empty row with your version:

Substitution history of formula
(...)
@r$c-> '(length (delq "" '("0")))
$1->   '(length (delq "" '("0")))
Result: 1

I tried substituting the empty quotes in the 'delq' with "0", '(""),
'("0")... but always got the same result: 1.

> I kept just one formula for clarity. I also tried to avoid absolute
> row and column numbers (the $3 seemed better than $<<< though
> so I kept it)
> : @II is the second separator, $> is the last column
> and $>> is the penultimate column.

Right, I want to better understand relative addressing, as each month
has a different number of columns (and some have different number of
rows), and I'd prefer having the same formulas everywhere. How would
you suggest me to address "from the third and until the next-to-last
column"?



reply via email to

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