Report Design
 Crystal Reports Forum : Crystal Reports .NET 2003 : Report Design
Message Icon Topic: How to Show Time Range in crystal report Post Reply Post New Topic
Author Message
kisetsu
Newbie
Newbie


Joined: 24 May 2007
Location: Malaysia
Online Status: Offline
Posts: 1
Quote kisetsu Replybullet Topic: How to Show Time Range in crystal report
    Posted: 24 May 2007 at 12:05am
Hi All, I am using crystal report for Visual Studio 2003.
My report is on daily basis. Data is taken from MS SQL DB 2K.
If data is not present for one specific then I need to just let it be empty.
e.g. of the time range :
Time | 8:00|8:10| 8:20|8:30 |8:40 |8:50|9:00|...

I wanna generate time start from 8 am to 8 pm , interval : 10min.
I tried to generate time by sql query. But when i show in report(put the field in details section), it will show as vertical. Got other where to generate the times and show in report?

Plus each time interval may be will have more than one record. Example :
at 8 am, production cut 3 size. each size is different qty.
HOw to put 3 records into same time interval?

Anyone got any idea for my problems?

Really appreaciate your help

Thanks in Advance.

Best Regards,
Kisetsu
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 28 May 2007 at 1:16pm

In order to show ALL times, even those without data, your times would have to be in your data - usually in a data table.

I would see about creating a table with something like the following structure:

TIME_GROUPS

START_HOUR             Number(2)
START_MINUTE          Number(2)
END_MINUTE             Number(2)
GROUP_NAME  Varchar(15)
 
Your data in this table would look something like this:
 
Start Hour   Start_Minute    End_Minute    Group_Name
8                 0                       10                   8:00
8                 10                     20                   8:10
...
8                 50                     60                   8:50
...
13               0                       10                   1:00
 
You'll notice how I set up the "end minute" for the last block of the hour as 60 - this will help you do the comparison in your SQL.  I also set this up to work on a 24-hour clock - also to make it easier to do the comparisons in SQL.
 
I work in Oracle and I'm not familiar with which commands are the same between Oracle and MS SQL and which are not, so you may need to translate some of this into something MS SQL would understand.  But, I would do something like this in my SQL:
Select tg.GROUP_NAME,
          t.LAST_CHANGE_DATE,
          t.FIELD1,
          t.FIELD2
from Table1 as t
left join Time_Groups as tg 
  on tg.START_HOUR = To_Number(To_Char(t.LAST_CHANGE_DATE, 'HH24'))
where To_Number(To_Char(t.LAST_CHANGE_DATE, 'MI'))
    between tg.START_MINUTE and tg.END_MINUTE
In the report, I would then set up a group on the GROUP_NAME field, a Sort on the LAST_CHANGE_DATE field, and put my data in the details.  This way your data will be grouped together in your 10-minute time-slots and then in time-order within those time slots.
 
-Dell 


Edited by hilfy - 28 May 2007 at 1:17pm
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.