Skip to Content
0

Need formula for Half hour increments

May 16 at 07:08 PM

28

avatar image
Former Member

Hi - Have a report that works fine for giving me a count every hour. However I would like to make it give me a count of every half hour!

Here are a few lines of the working every hour formula:

NumberVar HH;
StringVar HD;

HH := ToNumber({Trip_History_Reporting.modtime}[1 to 2]);

if HH = 8 then HD := "08:00 - 08:59" else
if HH = 9 then HD := "09:00 - 09:59" else
if HH = 10 then HD := "10:00 - 10:59" else
if HH = 11 then HD := "11:00 - 11:59" else

HD := "23:00 - 23:59"

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Dell Stinnett-Christy May 16 at 07:59 PM
0

Assuming that {Trip_History_Reporting.modtime} is a string (which is what your formula looks like) in the format hh:mm, I would try something like this:

NumberVar HH;
NumberVar mm;
StringVar HD;

HH := ToNumber({Trip_History_Reporting.modtime}[1 to 2]);
mm := ToNumber({Trip_History_Reporting.modtime}[4 to 5]);

if HH = 8 then 
  if mm < 30 then HD := "08:00 - 08:29" else HD := "08:30 - "08:59
elseif HH = 9 then 
  if mm < 30 then HD := "09:00 - 09:29" else HD := "09:30 - "09:59
elseif HH = 10 then HD := "10:00 - 10:59" 
  if mm < 30 then HD := "10:00 - 10:29" else HD := "10:30 - "10:59
elseif HH = 11 then HD := "11:00 - 11:59" 
  if mm < 30 then HD := "11:00 - 11:29" else HD := "11:30 - "11:59
else...

-Dell

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member May 17 at 07:47 AM
0

Works perfectly!

Thank you for the help!

Share
10 |10000 characters needed characters left characters exceeded