Thursday, March 22, 2012

Crystal reports grouping time stamps by hour

I made a report in crystal reports and its cross tabbed with Times on top, what i need to do is be able to group the times by hour but I have no clue how to do that

right now it looks like this:

8:01 8:11 8:15 8:45 9:15 9:34 and so on

it needs to be like this
8:00 9:00 and so on having everything in the 8-9 range under 8 and 9-10 under 9 and so on

I am using a Ms sql database and taking info from a number field numbers are in the format 800 for 8 oclock 930 for 9 thirty and so on

how would I group them like thisI'm not sure whether this folg is a right solution. but it'll work.

Try to create a formula and check the numeric value. Form a group using code
Like

If {table.field} in [800 to 830] then
1
else if {table.field} in [831 to 900] then
2
etc

Then group the report using this formula. To display the time interval create one more formula. Refer the previous formula here

i.e
if {@.prev} = 1 then
"8.00 - 8.30"
etc

Hope this will work.|||Thanx I will try that out,

No comments:

Post a Comment