From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Tables for attendance lists - A problem understanding TBLFM? Date: Mon, 8 Apr 2013 23:31:14 -0400 Message-ID: References: <20130408235753.GC109669@gwolf.org> <20130409002519.GA3195@kuru.dyndns-at-home.com> <20130409022123.GD112475@gwolf.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=14dae934123d87b7f704d9e52f09 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:41602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPPHC-0004ky-Vg for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 23:31:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPPHA-0004C3-98 for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 23:31:18 -0400 Received: from mail-ia0-x231.google.com ([2607:f8b0:4001:c02::231]:43776) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPPHA-0004Br-2X for emacs-orgmode@gnu.org; Mon, 08 Apr 2013 23:31:16 -0400 Received: by mail-ia0-f177.google.com with SMTP id w33so5732179iag.8 for ; Mon, 08 Apr 2013 20:31:15 -0700 (PDT) In-Reply-To: <20130409022123.GD112475@gwolf.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Gunnar Wolf Cc: emacs-orgmode@gnu.org --14dae934123d87b7f704d9e52f09 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Mon, Apr 8, 2013 at 10:21 PM, Gunnar Wolf 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=E1rdenas, L=E1zaro | 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=3D'(length '($3..$7))::@6$2=3Dvmean($3..$7);%.2f:= :@6 > $3..@6$7=3D'(length '(@2..@5))::@6$8=3Dvmean(@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 $>=3Dsum($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 =20 you can easily work around it, using (delq "" list) which deletes empty =20 strings from the list. Try this: #+CAPTION: Attendances for April |---------+-------------------+---+---+---+---+----+-------| | Account | Name | 1 | 3 | 5 | 8 | 10 | Total | |---------+-------------------+---+---+---+---+----+-------| | 1234 | C=E1rdenas, L=E1zaro | 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$>=3D'(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 --14dae934123d87b7f704d9e52f09 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Mon, Apr 8, 2013 at 10:21 PM, Gunnar Wolf <gwolf@gwolf.org><= /span> wrote:
Suvayu Ali dijo [Tue, Apr 09, 2013 at 02:25:19AM +0200]:
> On Mon, Apr 08, 2013 at 06:57:53PM -0500, Gunna= r Wolf wrote:
> > #+CAPTION: Attendances for April
> > |---------+-------------------+---+---+---+---+----+-------|
> > | Account | Name =A0 =A0 =A0 =A0 =A0 =A0 =A0| 1 | 3 | 5 | 8 | 10 = | Total |
> > |---------+-------------------+---+---+---+---+----+-------|
> > | =A0 =A01234 | C=E1rdenas, L=E1zaro =A0| X | =A0 | X | X | =A0 = =A0| =A0 =A0 3 |
> > | =A0 =A05678 | Madero, Francisco | X | X | X | X | =A0 =A0| =A0 = =A0 4 |
> > | =A0 =A01544 | Villa, Pancho =A0 =A0 | =A0 | =A0 | =A0 | =A0 | = =A0 =A0| =A0 =A0 1 |
> > | =A0 =A00113 | Zapata, Emiliano =A0| =A0 | X | X | =A0 | =A0 =A0= | =A0 =A0 2 |
> > |---------+-------------------+---+---+---+---+----+-------|
> > | Day avg | 2.25 =A0 =A0 =A0 =A0 =A0 =A0 =A0| 2 | 2 | 3 | 2 | =A0= 1 | =A02.50 |
> > |---------+-------------------+---+---+---+---+----+-------|
> > #+tblfm: @2$8..@5$8=3D'(length '($3..$7))::@6$2=3Dvmean($= 3..$7);%.2f::@6$3..@6$7=3D'(length '(@2..@5))::@6$8=3Dvmean(@2..@5)= ;%.2f
>
> Probably not what you were looking for, why complicate things by using=
> Xs instead of just a numeral like 1? =A0If you use 1, then you can use= a
> column formula; maybe something like $>=3Dsum($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' w= ould do
for me, I'd rather present to the students something they are more
likely to understand as natural.


You can turn on formula d= ebugging with C-c { and then you'd
see that in Pancho's case, t= he list is ("") i.e. a list containing the
empty string - a list of length 1. That mi= ght qualify as a bug (or not) but
y= ou can easily work around it, using (delq "" list) which deletes = empty
strings from the = list.

Try this:

|---------+-------------------+-= --+---+---+---+----+-------|
| Account | Name =A0 =A0 =A0 =A0 =A0 =A0 =A0| 1 | 3 | 5 | 8 | 10 |= Total |
|---------+-------------------+-= --+---+---+---+----+-------|
| =A0 =A01234 | C=E1rdenas, L=E1zaro =A0| X | =A0 | X | X | =A0 = =A0| =A0 =A0 3 |
| =A0 =A05678 | Madero, Francisc= o | X | X | X | X | =A0 =A0| =A0 =A0 4 |
| =A0 =A01544 | Villa, Pancho =A0 =A0 | =A0 | =A0 | = =A0 | =A0 | =A0 =A0| =A0 =A0 0 |
| =A0 =A00113 | Zapata, Emiliano= =A0| =A0 | X | X | =A0 | =A0 =A0| =A0 =A0 2 |
|---------+-------------------+---+---+---+---+= ----+-------|
#+tblfm: @II+1$>..@III-1$>= =3D'(length (delq "" '($<<<..$>>)))=


<= /font>
I kept just one formula for clar= ity. I also tried to avoid absolute
row and column numbers (the $3 seemed better than $&l= t;<< though
so I kept it)
: @II is the second separator, $> is the last column
and $>= > is the penultimate column.
HTH,
Nick


--14dae934123d87b7f704d9e52f09--