emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: news1142@karl-voit.at, Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Help on spreadsheet/calc references and improvements
Date: Sun, 6 Oct 2013 19:03:47 +0200	[thread overview]
Message-ID: <CALn3zohT56cm49RDQRi=uSXLcS4gVqozZ7YbgHT-L4MFaqRwFQ@mail.gmail.com> (raw)
In-Reply-To: <2013-10-06T13-22-35@devnull.Karl-Voit.at>

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

Hi Karl, hi all

@maintainers:
According to the below I tried to improve the Org manual with the
attached patch, please review and apply.

On Sun, Oct 6, 2013 at 1:30 PM, Karl Voit <devnull@karl-voit.at> wrote:
> The things I learned about referencing other tables I documented in [1].
>
> Maybe you'll find it handy as a reference to referencing tables :-)
>
>   1. https://raw.github.com/novoid/org-mode-workshop/master/featureshow/org-mode-teaser.org
>      search for "referencing example with detailed explanation"

Yes, with all the explanations of how the formulas work your github
novoid/org-mode-workshop contains a very nice spreadsheet
documentation, for more than just referencing remote tables. Can you
please link the section here with mentioning that it contains
explanations of how the formulas work?:
http://orgmode.org/worg/org-tutorials/index.html

Your new example in github novoid/org-mode-workshop with
@2=remote(Income2012h, @3$$#)
- motivated by my example in the current Org manual
- that interprets text as a Calc algebraic expression, which is
  subject to reformatting
reminded me of that just copying fields is better done with a Lisp
formula "'(identity [...])", see attached patch for the Org manual.

Michael

[-- Attachment #2: 0001-Improve-manual-for-table-formulas.patch.txt --]
[-- Type: text/plain, Size: 2626 bytes --]

From a3efc3edd94ccc21544792ddde4a6c54284100ce Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.brand@gmail.com>
Date: Sun, 6 Oct 2013 19:01:15 +0200
Subject: [PATCH] Improve manual for table formulas

* doc/org.texi (Field coordinates in formulas): Rephrase and add an
example with a Lisp formula to copy from remote table.
---
 doc/org.texi | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 0271d70..0a90d33 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -2551,21 +2551,28 @@ for Calc}.
 @cindex row, of field coordinates
 @cindex column, of field coordinates
 
-For Calc formulas and Lisp formulas @code{@@#} and @code{$#} can be used to
-get the row or column number of the field where the formula result goes.
-The traditional Lisp formula equivalents are @code{org-table-current-dline}
-and @code{org-table-current-column}.  Examples:
+One of the very first actions during evaluation of Calc formulas and Lisp
+formulas is to substitute @code{@@#} and @code{$#} in the formula with the
+row or column number of the field where the current result will go to.  The
+traditional Lisp formula equivalents are @code{org-table-current-dline} and
+@code{org-table-current-column}.  Examples:
 
-@example
-if(@@# % 2, $#, string(""))   @r{column number on odd lines only}
-$3 = remote(FOO, @@@@#$2)      @r{copy column 2 from table FOO into}
-                             @r{column 3 of the current table}
-@end example
+@table @code
+@item if(@@# % 2, $#, string(""))
+Insert column number on odd rows, set field to empty on even rows.
+@item $2 = '(identity remote(FOO, @@@@#$1))
+Copy text or values of each row of column 1 of the table named @code{FOO}
+into column 2 of the current table.
+@item @@3 = 2 * remote(FOO, @@1$$#)
+Insert the doubled value of each column of row 1 of the table named
+@code{FOO} into row 3 of the current table.
+@end table
 
-@noindent For the second example, table FOO must have at least as many rows
-as the current table.  Note that this is inefficient@footnote{The computation time scales as
-O(N^2) because table FOO is parsed for each field to be copied.} for large
-number of rows.
+@noindent For the second/third example, the table named @code{FOO} must have
+at least as many rows/columns as the current table.  Note that this is
+inefficient@footnote{The computation time scales as O(N^2) because the table
+named @code{FOO} is parsed for each field to be read.} for large number of
+rows/columns.
 
 @subsubheading Named references
 @cindex named references
-- 
1.7.12.4 (Apple Git-37)


  reply	other threads:[~2013-10-06 17:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-05 14:49 Help on spreadsheet/calc references and improvements Karl Voit
2013-10-05 15:16 ` Michael Brand
2013-10-05 16:08   ` Karl Voit
2013-10-05 16:44     ` Michael Brand
2013-10-06 11:30 ` Karl Voit
2013-10-06 17:03   ` Michael Brand [this message]
2013-10-06 18:31     ` Karl Voit
2013-10-06 19:38       ` Michael Brand
2013-10-06 20:06         ` Karl Voit
2013-10-06 20:51           ` Michael Brand
2013-10-18 19:07     ` Michael Brand
2013-10-23 15:12       ` Michael Brand
2013-10-24  6:18         ` Carsten Dominik
2013-10-24 20:47           ` Michael Brand
2013-10-25 10:56             ` Nicolas Goaziou
2013-10-25 13:30               ` Carsten Dominik
2013-10-25 17:03                 ` Nicolas Goaziou
2013-10-25 13:31             ` Carsten Dominik
2013-10-30 17:59               ` Michael Brand
2013-11-13 17:27                 ` Michael Brand
2013-11-13 17:34                   ` Bastien
2013-11-13 19:42                     ` Michael Brand
2013-11-13 23:21                       ` 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='CALn3zohT56cm49RDQRi=uSXLcS4gVqozZ7YbgHT-L4MFaqRwFQ@mail.gmail.com' \
    --to=michael.ch.brand@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=news1142@karl-voit.at \
    /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).