Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Calculate Days Used Post Reply Post New Topic
Author Message
huff
Newbie
Newbie


Joined: 10 Apr 2015
Online Status: Offline
Posts: 4
Quote huff Replybullet Topic: Calculate Days Used
     Posted: 02 Jun 2015 at 3:50am
I have a file that has an employee's begin date and, sometimes, an end date. I have another file that has each day of the year listed in it and whether it is a 'countable' day or not.

I need to be able to count the number 'countable' days for each employee from the begin date and to the end date (or the end of the fiscal year if there is no end date, which is sometime in June) from the first file. I can't come up with a way to make this work, so any help you could provide would be greatly appreciated!

Thank you.

Con
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Jun 2015 at 4:05am
use a command to join the tables together
select * from
Employee e
JOIN
Dates d ONĀ  e.hiredate<=d.date and ISNULL(e.termdate,'6/30/2015')>=d.date
WHERE d.countable = true condition
IP IP Logged
huff
Newbie
Newbie


Joined: 10 Apr 2015
Online Status: Offline
Posts: 4
Quote huff Replybullet Posted: 02 Jun 2015 at 4:45am
So, I would have both tables in the Linked Tables area, but not have them linked, correct?

Where would I be placing the Select statement to join the tables?

Sorry, this is fairly new to me.

Con
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Jun 2015 at 4:55am
No. The command replaces the data source (tables).
I was recommending a command because your need to dummy in the FY end for still active employees.
YOur join is on the hire and term date fields to the date field in the calendar table.
it will create one row of data per day per employee between the hire and term dates making the day counts pretty straight forward.
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