From: Nick Dokos <ndokos@gmail.com>
To: Gunnar Wolf <gwolf@gwolf.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: Tables for attendance lists - A problem understanding TBLFM?
Date: Mon, 8 Apr 2013 23:31:14 -0400 [thread overview]
Message-ID: <CANU-iVAbsDbrAqo-8dp1OW-UOzJuaWgi-7YRuvxNpAdc+fAP2Q@mail.gmail.com> (raw)
In-Reply-To: <20130409022123.GD112475@gwolf.org>
[-- Attachment #1: Type: text/plain, Size: 2715 bytes --]
On Mon, Apr 8, 2013 at 10:21 PM, Gunnar Wolf <gwolf@gwolf.org> 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: @2$8..@5$8='(length '($3..$7))::@6$2=vmean($3..$7);%.2f::@6
> $3..@6$7='(length '(@2..@5))::@6$8=vmean(@2..@5);%.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$>..@III-1$>='(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
[-- Attachment #2: Type: text/html, Size: 5581 bytes --]
next prev parent reply other threads:[~2013-04-09 3:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-08 23:57 Tables for attendance lists - A problem understanding TBLFM? Gunnar Wolf
2013-04-09 0:25 ` Suvayu Ali
2013-04-09 2:21 ` Gunnar Wolf
2013-04-09 3:31 ` Nick Dokos [this message]
2013-04-09 3:34 ` Nick Dokos
2013-04-09 12:40 ` Michael Brand
2013-04-09 14:57 ` Gunnar Wolf
2013-04-09 17:06 ` Bastien
2013-04-11 12:15 ` Michael Brand
2013-04-14 8:04 ` Michael Brand
2013-04-14 10:11 ` Bastien
2013-04-14 11:17 ` Michael Brand
2013-04-14 23:28 ` Bastien
2013-04-09 14:55 ` Gunnar Wolf
2013-04-09 15:10 ` Nick Dokos
2013-04-09 15:31 ` Gunnar Wolf
2013-04-09 15:34 ` Michael Brand
2013-04-09 15:50 ` Michael Brand
2013-04-09 16:03 ` Nick Dokos
2013-04-09 16:13 ` Gunnar Wolf
2013-04-09 12:41 ` Michael Brand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANU-iVAbsDbrAqo-8dp1OW-UOzJuaWgi-7YRuvxNpAdc+fAP2Q@mail.gmail.com \
--to=ndokos@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=gwolf@gwolf.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).