From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cecil Westerhof Subject: Re: I do not understand this error Date: Thu, 12 Jul 2007 08:34:25 +0200 Message-ID: <1184222066.6283.191.camel@Barebusta.DecebalComp> References: <1184220422.6252.181.camel@Barebusta.DecebalComp> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I8sG0-0006dP-1W for emacs-orgmode@gnu.org; Thu, 12 Jul 2007 02:34:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I8sFx-0006dC-Km for emacs-orgmode@gnu.org; Thu, 12 Jul 2007 02:34:30 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I8sFx-0006d9-Eu for emacs-orgmode@gnu.org; Thu, 12 Jul 2007 02:34:29 -0400 Received: from smtp-vbr7.xs4all.nl ([194.109.24.27]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I8sFw-00074r-IQ for emacs-orgmode@gnu.org; Thu, 12 Jul 2007 02:34:29 -0400 Received: from Barebusta.DecebalComp (DecebalComputing.xs4all.nl [213.84.157.201]) by smtp-vbr7.xs4all.nl (8.13.8/8.13.8) with ESMTP id l6C6YQGq028297 for ; Thu, 12 Jul 2007 08:34:26 +0200 (CEST) (envelope-from CecilWesterhof@xs4all.nl) In-Reply-To: <1184220422.6252.181.camel@Barebusta.DecebalComp> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode Op do, 12-07-2007 te 08:07 +0200, schreef Cecil Westerhof: > I have the following table: > |---+------------+---------+---------+--------+--------+-------+-------------------+----------+--------| > | | datum | kmstand | prijs/l | liters | dagen | prijs | km's | prijs/km | km/l | > |---+------------+---------+---------+--------+--------+-------+-------------------+----------+--------| > | # | | 155111 | | | | | | | | > | # | 2007-07-09 | 156146 | 102.2 | 62.25 | #ERROR | 63.62 | 1035 | 6.147 | 16.627 | > | # | 2007-09-11 | 6953 | 97.8 | 47.75 | #ERROR | 46.70 | Verkeerde kmstand | | | > | # | | | | | #ERROR | | | | | > |---+------------+---------+---------+--------+--------+-------+-------------------+----------+--------| > #+TBLFM: $6='(if (and (not (check-if-after-hline)) (nz @-1$2) (nz $2)) (- (time-to-days (org-read-date t t "$2")) (time-to-days (org-read-date t t "@-1$2"))) "");S::$7='(if (and (nz $4) (nz $5)) (format "%.2f" (/ (* $4 $5) 100)) "");N::$8='(if (and (nz @-1$3) (nz $3)) (if (> $3 @-1$3) (- $3 @-1$3) (if (not (check-if-after-hline)) "Verkeerde kmstand" "")) "");N::$9='(if (and (nz $8) (nz $7)) (format "%.3f" (/ (* $7 100) $8)) "");N::$10='(if (and (nz $8) (nz $5)) (format "%.3f" (/ $8 $5)) "");N I should not use 'nz', but 'not' and 'equal'. This gives: |---+------------+---------+---------+--------+-------+-------+-------------------+----------+--------| | | datum | kmstand | prijs/l | liters | dagen | prijs | km's | prijs/km | km/l | |---+------------+---------+---------+--------+-------+-------+-------------------+----------+--------| | # | | 155111 | | | | | | | | | # | 2007-07-09 | 156146 | 102.2 | 62.25 | -3 | 63.62 | 1035 | 6.147 | 16.627 | | # | 2007-09-11 | 6953 | 97.8 | 47.75 | 64 | 46.70 | Verkeerde kmstand | | | | # | | | | | | | | | | |---+------------+---------+---------+--------+-------+-------+-------------------+----------+--------| #+TBLFM: $6='(if (and (not (check-if-after-hline)) (not (equal @-1$2 "")) (not (equal $2 ""))) (- (time-to-days (org-read-date t t (concat $2))) (time-to-days (org-read-date t t (concat @-1$2)))) "");S::$7='(if (and (nz $4) (nz $5)) (format "%.2f" (/ (* $4 $5) 100)) "");N::$8='(if (and (nz @-1$3) (nz $3)) (if (> $3 @-1$3) (- $3 @-1$3) (if (not (check-if-after-hline)) "Verkeerde kmstand" "")) "");N::$9='(if (and (nz $8) (nz $7)) (format "%.3f" (/ (* $7 100) $8)) "");N::$10='(if (and (nz $8) (nz $5)) (format "%.3f" (/ $8 $5)) "");N The only problem is that in the second element of 'dagen' there stands '-3'. It looks like it that '(not (equal @-1$2 ""))' is not correctly is evaluated. -- Cecil Westerhof