cancel
Showing results for 
Search instead for 
Did you mean: 

Need formula for Half hour increments

Former Member
0 Kudos

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"

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor
0 Kudos

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

Answers (1)

Answers (1)

Former Member
0 Kudos

Works perfectly!

Thank you for the help!