From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Loris Bennett" Subject: Conditional in table formula with times Date: Fri, 21 Feb 2014 08:49:01 +0100 Message-ID: <871tywlxci.fsf@hornfels.zedat.fu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGkrJ-00040k-GW for emacs-orgmode@gnu.org; Fri, 21 Feb 2014 02:49:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGkrC-0000b8-5v for emacs-orgmode@gnu.org; Fri, 21 Feb 2014 02:49:21 -0500 Received: from plane.gmane.org ([80.91.229.3]:51247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGkrB-0000b4-Va for emacs-orgmode@gnu.org; Fri, 21 Feb 2014 02:49:14 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WGkrA-0006nt-0Y for emacs-orgmode@gnu.org; Fri, 21 Feb 2014 08:49:12 +0100 Received: from hornfels.zedat.fu-berlin.de ([160.45.11.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 21 Feb 2014 08:49:12 +0100 Received: from loris.bennett by hornfels.zedat.fu-berlin.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 21 Feb 2014 08:49:12 +0100 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: emacs-orgmode@gnu.org Hi, I'm trying to keep track of total time spend at work, but I am having trouble with a conditional in table formula: | *Day* | *Came* | *Went* | *Worked* | *Required* | *Diff* | |------------------+--------+--------+----------+------------+----------| | [2014-01-06 Mon] | 8:00 | 17:00 | 09:00:00 | 00:00:00 | 09:00:00 | | [2014-01-07 Tue] | | | 00:00:00 | 00:00:00 | 00:00:00 | | [2014-01-08 Wed] | 8:10 | 16:30 | 08:20:00 | 00:00:00 | 08:20:00 | | [2014-01-09 Thu] | 7:55 | 17:05 | 09:10:00 | 00:00:00 | 09:10:00 | | [2014-01-10 Fri] | 8:00 | 17:05 | 09:05:00 | 00:00:00 | 09:05:00 | #+TBLFM: $4=$3-$2;T::$5=if($4 > 0,"8:18:00","00:00:00");T::$6=$4-$5;T Debugging the formula gives me for @2$5: ,--------------------------------------------- | Substitution history of formula | Orig: if($4 > 0,"8:18:00","00:00:00");T | $xyz-> if($4 > 0,"8:18:00","00:00:00") | @r$c-> if($4 > 0,"8:18:00","00:00:00") | $1-> if((32400) > 0,"8:18:00","00:00:00") | Result: 00:00:00 | Format: NONE | Final: 00:00:00 `--------------------------------------------- and for @3$5: ,------------------------------------------ | Substitution history of formula | Orig: if($4 > 0,"8:18:00","00:00:00");T | $xyz-> if($4 > 0,"8:18:00","00:00:00") | @r$c-> if($4 > 0,"8:18:00","00:00:00") | $1-> if((0) > 0,"8:18:00","00:00:00") | Result: 00:00:00 | Format: NONE | Final: 00:00:00 `------------------------------------------ Can anyone enlighten me as to why I get "00:00:00" in the first case? Cheers, Loris -- This signature is currently under construction.