Partition function with time-type arguments

T

Tom

I cant' cope with mayby a simple question of how to use Partition
function with time-type arguments. I would like to group data based on
[timeCol] column which shows time detailed down to the second
'hh:mm:ss' using partition(col,start,end,interval) function for groups
with time from 9 AM to 5 PM (17:00) every 30 minutes. I entered
something like this to the project grid in A2000:

new filed name: Partition([timeCol];#09:00:00#;#17:00:00#;minutes(30))
or
new filed name: Partition([timeCol];#09:00:00#;#17:00:00#;#00:30:00#)
or
new filed name: Partition([timeCol];#09:00:00#;#17:00:00#;
(1800/86399))
where 1800 - number of sek in 30 min; 86399 number of sek within the
whole day from 00:00 to 23:59:59

but none of these is working.
How should it be done properly ? Sorry, but I don't know a thing about
time arguments in A2000.


Thanks
Tom
 
T

Tom

The function seems to be there in A2000 because I used it several
times with non-date/time arguments.
In the msdn reference I probably figured out why it wasn't working -
the msdn docs says that args should be Long (integer-like non-
fractional) and as I checked time of a day is represented as a non-
integer type - fraction between zero and 0,999 in VBA.
So I found a way - round by scaling:
fieldName : Partition(86399*[timeCol];86399*#09:00:00#;
86399*#17:00:00#;86399*#00:30:00#)
(there is 86399 secs in 23:59:59 hours)
and then scaling back:
CDate(CLng([field])/86399)
which works down to a single sec precision
Thanks anyway
BTW, I would like to see Partition function doing work on non-integer
fractional args someday.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top