Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Active Employee Formula Post Reply Post New Topic
Page  of 2 Next >>
Author Message
wpshc
Newbie
Newbie


Joined: 06 Aug 2010
Online Status: Offline
Posts: 6
Quote wpshc Replybullet Topic: Active Employee Formula
    Posted: 06 Aug 2010 at 10:44am
Just looking for some help here.  I am new to the forum, and would appreciate any advice.

I am looking at creating a report that gives me an 'active snapshot' at any point in time.  So far, I have not been able to do this.  My main problem is that my 'TERMDATE' field is not null, but, instead, all employees that have not been terminated have (1899, 12, 31) as their termdate.

This is the closest I have gotten to a formula.  The date I am going back to for the active snapshot is January 1, 2009.  GLB_STDT is the date the employee started with our organization, and, obviously TERMDATE is the date their employment ended.  To me, the logic makes sense but for some reason it is not working:

if {EMP_MAST.GLB_STDT} > Date (2009,01,01) then false or
if {EMP_MAST.TERMDATE} <=
Date (2009,01,01) then false or
if {EMP_MAST.TERMDATE} = Date (1899,12,31) then true


I would appreciate any help with this!

Thank you in advance!


Edited by wpshc - 06 Aug 2010 at 10:44am
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 06 Aug 2010 at 11:25am

How about this

if ({EMP_MAST.GLB_STDT} <=Date (2009,01,01)) and
{EMP_MAST.TERMDATE} > Date (2009,01,01)) or
{EMP_MAST.TERMDATE} = Date (1899,12,31) then true
 
I believe this logic matches what you are showing.
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 06 Aug 2010 at 11:51am

IMO I think you are looking for a change in select logic here. You want to be able to enter a date and see what emplyees were 'active' as of that date, correct?

one way would be to create a parameter as a date type and then the select statement would be:
{?date} in {EMP_MAST.GLB_STDT} to (if {EMP_MAST.TERMDATE}=Date (1899,12,31) then currentdate else {EMP_MAST.GLB_STDT})
IP IP Logged
wpshc
Newbie
Newbie


Joined: 06 Aug 2010
Online Status: Offline
Posts: 6
Quote wpshc Replybullet Posted: 10 Aug 2010 at 2:54am
DBlank, that seems to have worked!  I have been trying to work through your logic, but cannot figure it out.

Is there a formula/select logic that would give me active employees over a period of time?  For example, if I wanted to know who was active from 2007-2009.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Aug 2010 at 4:33am
You need to date params, you can name them whatever but I will use 
?start and ?end.
 
I think this will work:
({?start}<= (if {EMP_MAST.TERMDATE}=Date (1899,12,31) then currentdate else {EMP_MAST.GLB_STDT}) )
and
({?end}>={EMP_MAST.GLB_STDT})
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Aug 2010 at 4:34am
be sure to test the data out pretty well on the above as I am not 100% sure that will give you all the possible rows
Wacko
IP IP Logged
wpshc
Newbie
Newbie


Joined: 06 Aug 2010
Online Status: Offline
Posts: 6
Quote wpshc Replybullet Posted: 10 Aug 2010 at 9:41am
Thank you very much for your help!  I will be putting it to the test shortly.
IP IP Logged
wpshc
Newbie
Newbie


Joined: 06 Aug 2010
Online Status: Offline
Posts: 6
Quote wpshc Replybullet Posted: 11 Aug 2010 at 4:38am
Hmmm... DBlank, I am wondering whether the following formula you provided would show an employee who was active on ?Date but has since been terminated?  Or will it omit such an employee.
 
{?date} in {EMP_MAST.GLB_STDT} to (if {EMP_MAST.TERMDATE}=Date (1899,12,31) then currentdate else {EMP_MAST.GLB_STDT})
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Aug 2010 at 4:40am
It will show them active as of that date entered (and may be termintaed now).
I thought you wanted a point in time snap shot, not currently active.
What exactly do you want to ee?


Edited by DBlank - 11 Aug 2010 at 4:41am
IP IP Logged
wpshc
Newbie
Newbie


Joined: 06 Aug 2010
Online Status: Offline
Posts: 6
Quote wpshc Replybullet Posted: 11 Aug 2010 at 11:02am
Yes, I want active as at a given point in time.  You answered my question. 
 
 
I DO want employees to show up on ?Date even if they have since been terminated (because at ?Date they were active).  I was just making sure that the formula provided accomplishes this.


Edited by wpshc - 11 Aug 2010 at 11:03am
IP IP Logged
Page  of 2 Next >>
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.047 seconds.