Skip to Content
avatar image
Former Member

Need formula for Half hour increments

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"

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    May 16 at 07:59 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 17 at 07:47 AM

    Works perfectly!

    Thank you for the help!

    Add comment
    10|10000 characters needed characters exceeded