Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Show all dates Post Reply Post New Topic
Author Message
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Topic: Show all dates
     Posted: 07 Dec 2014 at 11:34pm
Morning all,

Does anybody have a good method for showing all dates in a report, whether there is data for them or not?

For example; you are reporting on a count of items every day for a month. There is no data for 01/11 and 02/11 but there is on the 03/11. As the Report has a group, on Date, the report essentially starts from the 03rd.

Is there a good way to force the report to show all dates regardless of data?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Dec 2014 at 4:15am

create or use a calendar table that has all the calendar days in it an do an outer join to it and filter against the calendar dates table field.

Or you can create the illusion of it by doing a variable formuls to loop through the days and build a string that mimics the displaying of the missing dates but this is more difficult and does not really give you queriable data. Using a "calendar" table is so much easier.


Edited by DBlank - 08 Dec 2014 at 4:17am
IP IP Logged
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Posted: 08 Dec 2014 at 4:33am
Thanks DBlank, the problem being one would have to create a calendar day table :-)
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Dec 2014 at 4:39am
do you have rights to creating a table in your DB?
Well worth the effort as it can be used in all of your reports.
IP IP Logged
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Posted: 08 Dec 2014 at 4:42am
Unfortunately not; I could see about creating one though. How have you structured yours? Literally just a one row table with dates and as many dates as you can enter into the future?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Dec 2014 at 5:35am
If you are going to create one it is usually useful to create it with may coulmns with different dateparts so you can use that as metadata for other things but it is not necessary.
One row per day back to where your overall DB data setsd start
mine ends in 2029 but I rarely need to look more than 2 years out.
as time moves on you likely will change your DB but you can alwasy append to it as needed.
 
Column ideas
 
DATE as DATE
DATE as DATETIME
YEAR
MONTH
MONTH NUMBER OF QUARTER
WEEK NUMBER OF YEAR
DAY NUMBER OF YEAR
MONTH ANME
DAY NAME
HOLIDAY / IS WORK DAY


Edited by DBlank - 08 Dec 2014 at 5:39am
IP IP Logged
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Posted: 08 Dec 2014 at 5:48am
Thanks mate :-)
IP IP Logged
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Posted: 09 Dec 2014 at 10:35pm
DBlank - am I right in thinking I could just create a Access database for this, rather than adding a table to my system database?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Dec 2014 at 3:46am

I have the table as part of my overall Database but this is really up to you and your set up.

IP IP Logged
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