Time Calculation
am 30.10.2007 12:54:55 von J T
Hi All
I am a new and novice filemaker user. I have a simple problem. I have
one field -Present Time and another field time of last meal. I wanted
to work out the fasting time (ie the difference betweek the two) in
hrs. For simplicity of data collection I wanted to class the result
into categories. i.e <2hrs, 2-4hrs, 4-6hrs, 6-12hrs, and >12.
Can someone please help me with this problem.
Thanks in advance
John
Re: Time Calculation
am 30.10.2007 22:32:45 von bill
In article <1193745295.480950.313240@o3g2000hsb.googlegroups.com>,
J T wrote:
> Hi All
>
> I am a new and novice filemaker user. I have a simple problem. I have
> one field -Present Time and another field time of last meal. I wanted
> to work out the fasting time (ie the difference betweek the two) in
> hrs. For simplicity of data collection I wanted to class the result
> into categories. i.e <2hrs, 2-4hrs, 4-6hrs, 6-12hrs, and >12.
>
> Can someone please help me with this problem.
>
> Thanks in advance
>
> John
1. You can simply subtract one time from the other, which will give a
result in standardized time format hh:mm:ss
To to this you can define a field
2. You can extract the Hours part of the time difference by using the
Hours() formula, which is built in.
3. You can do a Case calculation based on the Hours part, something like
this:
(Let HourDiff = Hours (Get(CurrentTime) - LastMealTime);
Case(
HourDiff < 2; A;
HourDiff <= 4; B;
HourDiff <= 6;C;
HourDiff <= 12; D;
E
)
)
Where A, B, C, D and E represent whatever result you want for each case.
The Let HourDiff statement at the start defines a variable that causes
the calculation of hours difference to run one time, rather than
recalculating the Hours for each case of the Case statement.
The Case statement acts on the first True result it finds, so there is
no need for ranges of hours in each case. If the HourDiff is <2, A will
happen and the calculation will ignore the rest, and so on.