From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Brand Subject: Re: Computations on properties Date: Wed, 9 Oct 2013 21:27:45 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTzQD-0001rn-LM for emacs-orgmode@gnu.org; Wed, 09 Oct 2013 15:27:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VTzQB-0003y5-TZ for emacs-orgmode@gnu.org; Wed, 09 Oct 2013 15:27:49 -0400 Received: from mail-lb0-x234.google.com ([2a00:1450:4010:c04::234]:61259) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTzQB-0003xh-Mf for emacs-orgmode@gnu.org; Wed, 09 Oct 2013 15:27:47 -0400 Received: by mail-lb0-f180.google.com with SMTP id q8so1186649lbi.39 for ; Wed, 09 Oct 2013 12:27:45 -0700 (PDT) In-Reply-To: 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: =?ISO-8859-1?Q?Thierry_Pell=E9?= Cc: Org Mode Hi Thierry On Wed, Oct 9, 2013 at 2:19 PM, Thierry Pell=E9 = wrote: > Mean Calculation=3DRES (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=3Dorg-mode.git;a=3Dblob;f=3Dtesting/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 =3D call_mean() =3D5.454545454545454=3D * code :noexport: #+NAME: mean #+HEADER: :var val1=3D'nil #+HEADER: :var val2=3D'nil #+HEADER: :var coef=3D'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