Hi all

need help in calculating time unit have field start time and end time, every 15 minutes interval for the first hour is 2 units and after 1 hour is 3 units ( still 15 minutes) should bring number not decimal i.e 16 minutes should be 2

thanks

Hi all

need help in calculating time unit have field start time and end time, every 15 minutes interval for the first hour is 2 units and after 1 hour is 3 units ( still 15 minutes) should bring number not decimal i.e 16 minutes should be 2

thanks

hi david

basically i have 5 fields

1. start time

2. end time

3. time unit calculation

4. rate per unit

5 total amount

what i need filemaker to do is on calculation field time unit to be number (not decimal)

every 15 minutes is 2 units for the first hour and 3 units for every 15 minutes after first hour

my answers(s) will be like this

14 minutes =2

17 minutes= 4

62 minutes= 11 (8 FOR THE FIRST HOUR AND 3 FOR 15 MINUTES AFTER 1 HOUR

THANKS@David

since I had already worked on this, here's another version ...

Let(

[

start = Main::timestamp1;

end = Main::timestamp2;

quarters = Ceiling ( (end - start) / 900 ); // 900 = 15min * 60sec

overFour = quarters - 4

];

Case(

overFour > 0; overFour * 3 + 8; // 8 = 2 units * 4 quarters

quarters > 0; quarters * 2;

-1 // error

)

)

- 1 person found this helpful
David Moyer wrote:

since I had already worked on this, here's another version ... [...]

I like your beginning better, but prefer my end; so let's combine the two:

Let ( [

t = GetAsNumber ( end - begin ) ;

q = Ceiling ( t / 900 ) ;

over = Max ( 0 ; q - 4 ) ;

under = q - over

] ;

under * 2 + over * 4

)

I like your beginning better, but prefer my end; so let's combine the two:

Let ( [

t = GetAsNumber ( end - begin ) ;

q = Ceiling ( t / 900 ) ;

over = Max ( 0 ; q - 4 ) ;

under = q - over

] ;

under * 2 + over * 4

)