emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [bug] spreadsheet does not replace some fields
Date: Fri, 24 Aug 2012 19:49:34 +0200	[thread overview]
Message-ID: <CALn3zog1nAirvLXvdB_FXGSYJns46fRMZaGQXZjFRkzxmMAgAA@mail.gmail.com> (raw)
In-Reply-To: <CALn3zoiS62tR5fFF5ydGuXwcUom9cRg8MwcsM7Y30k3XPXnyqQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1962 bytes --]

Hi all

On Wed, Jun 20, 2012 at 10:53 PM, Michael Brand
<michael.ch.brand@gmail.com> wrote:
> On Wed, Jun 20, 2012 at 3:47 PM, Juan Pechiar <juan@pechiar.com> wrote:
>> From the manual (section 3.5.6 Column Formulas):
>>
>>  If the table contains horizontal separator hlines, everything before
>>  the first such line is considered part of the table header and will
>>  not be modified by column formulas.
>
> Yes, of course, I should know! I read this some years ago but didn't
> realize then what effect it will have for me one day: All rows in my
> current example except the last one are just considered as the table
> header and everything becomes clear. How could I not conclude myself.
> Thank you for helping out.
>
> With this in mind it should be
>
> | item  | absolute | percent |
> |-------+----------+---------|
> | a     |       17 |      34 |
> | b     |       21 |      42 |
> | c     |       12 |      24 |
> |-------+----------+---------|
> | total |       50 |     100 |
> #+TBLFM: @>$2=vsum(@<<$2..@>>$2)::$3=100 * $2 / @>$2
>
> or
>
> |-------+----------+---------|
> | item  | absolute | percent |
> |-------+----------+---------|
> | a     |       17 |      34 |
> | b     |       21 |      42 |
> | c     |       12 |      24 |
> |-------+----------+---------|
> | total |       50 |     100 |
> |-------+----------+---------|
> #+TBLFM: @>$2=vsum(@<<$2..@>>$2)::$3=100 * $2 / @>$2
>
> and it is not possible to take the shortcut of
>
> | a     | 17 |     |
> | b     | 21 |     |
> | c     | 12 |     |
> |-------+----+-----|
> | total | 50 | 100 |
> #+TBLFM: @>$2=vsum(@<$2..@>>$2)::$3=100 * $2 / @>$2
>
> or
>
> |-------+----+-----|
> | a     | 17 |     |
> | b     | 21 |     |
> | c     | 12 |     |
> |-------+----+-----|
> | total | 50 | 100 |
> |-------+----+-----|
> #+TBLFM: @>$2=vsum(@<$2..@>>$2)::$3=100 * $2 / @>$2
>
> to group rows with hline

To make this clearer in the manual I suggest the attached small patch.

Michael

[-- Attachment #2: 0001-org.texi-Mention-when-a-table-header-is-mandatory.patch.txt --]
[-- Type: text/plain, Size: 1802 bytes --]

From 1f9cc08ecad6e7f78f44084f0d001203f04104a7 Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.brand@gmail.com>
Date: Fri, 24 Aug 2012 19:46:49 +0200
Subject: [PATCH] org.texi: Mention when a table header is mandatory

* org.texi (Column formulas): Add a sentence to be more explicit about
when a table header is mandatory.
---
 doc/org.texi |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index c33b5a9..cf0656c 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -2770,10 +2770,13 @@ Named field, see @ref{Advanced features}.
 When you assign a formula to a simple column reference like @code{$3=}, the
 same formula will be used in all fields of that column, with the following
 very convenient exceptions: (i) If the table contains horizontal separator
-hlines, everything before the first such line is considered part of the table
-@emph{header} and will not be modified by column formulas.  (ii) Fields that
-already get a value from a field/range formula will be left alone by column
-formulas.  These conditions make column formulas very easy to use.
+hlines with rows above and below, everything before the first such hline is
+considered part of the table @emph{header} and will not be modified by column
+formulas.  Therefore a header is mandatory when you use column formulas and
+want to add hlines to group rows, like for example to separate a total row at
+the bottom from the summand rows above.  (ii) Fields that already get a value
+from a field/range formula will be left alone by column formulas.  These
+conditions make column formulas very easy to use.
 
 To assign a formula to a column, type it directly into any field in the
 column, preceded by an equal sign, like @samp{=$1+$2}.  When you press
-- 
1.7.4.2


  reply	other threads:[~2012-08-24 17:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20 12:26 [bug] spreadsheet does not replace some fields Michael Brand
2012-06-20 13:47 ` Juan Pechiar
2012-06-20 20:53   ` Michael Brand
2012-08-24 17:49     ` Michael Brand [this message]
2012-08-24 17:53       ` Bastien

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=CALn3zog1nAirvLXvdB_FXGSYJns46fRMZaGQXZjFRkzxmMAgAA@mail.gmail.com \
    --to=michael.ch.brand@gmail.com \
    --cc=emacs-orgmode@gnu.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).