Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Posted: 07 Jun 2010 at 3:29am
I would try something like:
shared datetimevar lastValue;
local numbervar timeDiff := dateDiff("n", {table.field}, lastValue);
lastValue := {table.field};
timeDiff
It might need some tweeks, lastValue can be set in a group or the report to an initial value of first date, so that the DateDiff is 0, and other options can be added.
Hopefully as an alternate of looking at the problem it will get you to a solution.
local numbervar TimeDiff := DateDiff("n", {CATH.PATIENT_ON_TABLE}, lastValue);
lastValue := {CATH.PATIENT_ON_TABLE};
timeDiff
-----------------------------------------------------------------------------
My Reset Formula Field in a Group Header ( 5a ) above the line I am printing all my data on ( 5b ). I'm getting -140 with this formula where I should be getting 42 minutes. 0 is showing for the first field, which is good.
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Posted: 09 Jun 2010 at 2:45am
typically, if you get a negative when you want a positive...especially with dateDiff, just reverse the arguements. So put lastValue first. (I always get the order mixed up).
Now, you are getting 140, instead of 42. If this is the first time it was 'run', when did things start? Resetting the start time to midnight and then calculating the minutes from that might throw it off. I would think that the reset value would be {CATH.PATIENT_ON_TABLE}, as the first time you calculate, the diff is 0, as the values are the same.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum