emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Tables for attendance lists - A problem understanding TBLFM?
@ 2013-04-08 23:57 Gunnar Wolf
  2013-04-09  0:25 ` Suvayu Ali
  2013-04-09 12:41 ` Michael Brand
  0 siblings, 2 replies; 21+ messages in thread
From: Gunnar Wolf @ 2013-04-08 23:57 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

As mostly everything for my class work is handled through org-mode, I
am trying to use it also for tracking attendance. And it almost works
(given my quite-probably-wrong way to solve it) — Can you help me
pinpoint what am I doing wrong?

In case it's not obvious, I'm a complete Lisp newbie.

My attendance tables look similar to:

#+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

The formula tries to fill all of the numeric values (last row and
column), but has two important bugs. First, the (attempted) logic:

- Last column includes the sum of nonempty cells. I did this by
  counting the vector's length — But, as you can see, Pancho Villa
  lives up to his rebel's name and has consistently failed to come to
  class. Still, his entry shows he attended once.

  Digging a bit, I found (via M-:) that while (vconcat "X" nil "X" "X")
  yields a three element vector [88 88 88], and (vconcat nil nil nil)
  correctly yields an empty vector []. Getting the length of []
  correctly gives 0. So, I must be doing something wrong. Can you spot
  it?

- This same problem happens of course, getting the daily averages —
  We haven't yet reached April 10, but it shows one attendance.

So, is there a way to unb0rk my lists? Org-mode seems to be quite well
equiped for this task, and I'd hate to use other tools if I can stick
to this :)

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2013-04-14 23:28 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).