Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A custom interval for grouping datetime fields 1

Status
Not open for further replies.

jwaldner

Programmer
Jan 21, 2011
77
US
Is there a way that I can use a parameter in a formula to group date time fields by a custom interval in minutes? It also needs to filter for date and time range [so that a user could pick records in a particular date and time] and only group data within that range would be shown. its got me stumped. I am just not sure what the formula would look like.
 
//{@GroupInterval}:
dateadd("n",int((hour({table.datetime})*60 + minute({table.datetime}))/{?Time Interval})*{?Time Interval},
datetime(date({table.datetime}),time(0,0,0)))

Insert a group on the above formula. Limit the date and time range in the record selection formula. You could either specify a datetime range, as in:

{table.datetime} in {?datetimerange}

Or, you could limit the dates and times separately (if you wanted only certain times each day):

date({table.datetime}) = {?daterange} and
time({table.datetime}) = {?timerange}

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top