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: Nick Dokos
Subject: Re: [O] Tables for attendance lists - A problem understanding TBLFM?
Date: Mon, 8 Apr 2013 23:31:14 -0400

On Mon, Apr 8, 2013 at 10:21 PM, Gunnar Wolf <address@hidden> wrote:
Suvayu Ali dijo [Tue, Apr 09, 2013 at 02:25:19AM +0200]:
> On Mon, Apr 08, 2013 at 06:57:53PM -0500, Gunnar Wolf wrote:
> > #+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     |   |   |   |   |    |     1 |
> > |    0113 | Zapata, Emiliano  |   | X | X |   |    |     2 |
> > |---------+-------------------+---+---+---+---+----+-------|
> > | Day avg | 2.25              | 2 | 2 | 3 | 2 |  1 |  2.50 |
> > |---------+-------------------+---+---+---+---+----+-------|
> > #+tblfm: @address@hidden'(length '($3..$7))::@6$2=vmean($3..$7);%.2f::@address@hidden'(length '(@address@hidden))::@6$8=vmean(@address@hidden);%.2f
>
> Probably not what you were looking for, why complicate things by using
> Xs instead of just a numeral like 1?  If you use 1, then you can use a
> column formula; maybe something like $>=sum($3..$-1).

I had though about it, and it's currently a last resort for me. I want
to publish the lists in the course's webpage, and while a '1' would do
for me, I'd rather present to the students something they are more
likely to understand as natural.


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.

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 "" '($<<<..$>>)))


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.
HTH,
Nick



reply via email to

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