From: Michael Brand <michael.ch.brand@gmail.com>
To: "Thierry Pellé" <thierry.pelle@soliavos.fr>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Computations on properties
Date: Wed, 9 Oct 2013 21:27:45 +0200 [thread overview]
Message-ID: <CALn3zogZFF6pKg1Ef-wH0r2tViWdvCE2iBFptD-RN7pP7P493g@mail.gmail.com> (raw)
In-Reply-To: <loom.20131009T141208-743@post.gmane.org>
Hi Thierry
On Wed, Oct 9, 2013 at 2:19 PM, Thierry Pellé <thierry.pelle@soliavos.fr> wrote:
> Mean Calculation=RES (where RES is the value of the result)
One more variant would be to use inline source block calls either
interactively with C-c C-c or during export. An example with shell
(python would be very similar) or the built-in Emacs Lisp is in the
Emacs Regression Test ERT in the top heading "use case of reading
entry properties" here:
http://orgmode.org/w/?p=org-mode.git;a=blob;f=testing/examples/babel.org
Your use case, here with Emacs Lisp, would be e. g.:
--------------------------------
* Mean Calculation
:PROPERTIES:
:VAL1: 5
:VAL2: 10
:COEF: 10
:END:
Mean Calculation = call_mean() =5.454545454545454=
* code :noexport:
#+NAME: mean
#+HEADER: :var val1='nil
#+HEADER: :var val2='nil
#+HEADER: :var coef='nil
#+BEGIN_SRC emacs-lisp :exports none
(setq
val1 (string-to-number (org-entry-get
org-babel-current-src-block-location "VAL1" t))
val2 (string-to-number (org-entry-get
org-babel-current-src-block-location "VAL2" t))
coef (string-to-number (org-entry-get
org-babel-current-src-block-location "COEF" t)))
(/ (+ (* val1 coef) val2) (+ coef 1.0))
#+END_SRC
--------------------------------
Michael
next prev parent reply other threads:[~2013-10-09 19:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-09 12:19 Computations on properties Thierry Pellé
2013-10-09 12:50 ` Thorsten Jolitz
2013-10-09 13:32 ` Thierry Pellé
2013-10-09 15:29 ` Eric Abrahamsen
2013-10-09 17:12 ` Thorsten Jolitz
2013-10-09 18:21 ` Eric Abrahamsen
2013-10-09 18:23 ` Eric Schulte
2013-10-10 4:52 ` Eric Abrahamsen
2013-10-09 19:27 ` Michael Brand [this message]
2013-10-10 6:39 ` Thierry Pellé
2013-10-10 9:04 ` 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=CALn3zogZFF6pKg1Ef-wH0r2tViWdvCE2iBFptD-RN7pP7P493g@mail.gmail.com \
--to=michael.ch.brand@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=thierry.pelle@soliavos.fr \
/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).