Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Looping Post Reply Post New Topic
Author Message
wsparks
Newbie
Newbie


Joined: 26 Jun 2008
Location: United States
Online Status: Offline
Posts: 5
Quote wsparks Replybullet Topic: Looping
     Posted: 08 Jul 2008 at 11:02am

NEED HELP!!!

I have a table that has the effective date of daily hours and I am trying to link to another table that has an effective dated wage rate in order to determine the wage rate for that effective date.
 
I have come up with the following, but I need to have the IF THEN statement loop until it is true and returns the BASEWAGEHOURLYAMT.  I tried to put in the DO WHILE loop, but I think my format was wrong.
 
Local DateVar Date1;
Date1 := Date({BASEWAGERTHIST.EFFECTIVEDTM});
Local DateVar Date2;
Date2 := Date({BASEWAGERTHIST.EXPIRATIONDTM});
Local DateVar Date3;
Date3 := Date({KNX_VIEW_WFCTTL_LABOR.APPLYDTM});

If Date3 >= Date1 and
Date3 < Date2 Then
{BASEWAGERTHIST.BASEWAGEHOURLYAMT}
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 09 Jul 2008 at 12:29am
Can you rephrase the question? I've been coding all night and I'm pretty tired, and I'm just not catching what you want to do. What is the purpose of having a loop? Are you grouping the data so that you can put BaseWageHourlyAmount in the group footer? Sorry, just not understanging everything.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
wsparks
Newbie
Newbie


Joined: 26 Jun 2008
Location: United States
Online Status: Offline
Posts: 5
Quote wsparks Replybullet Posted: 09 Jul 2008 at 7:52am
Brian,
thanks for the reply. 
 
What I am trying to do is to return an effective dated hourly rate by determining when the work day is between the wage rate effective  (beginning) date and expiration date.
 
The effective dated wage rate is in a table like this:
 
BASEWAGERTHIST
Employeeid; Basehourlywageamt; EffectiveDTM; ExpirationDTM
 
The table that is linked to the BASEWAGERTHIST is
KNX_VIEW_WFCTTL_LABOR
Employeeid; ApplyDTM
 
I am linking on Employeeid, but need to return the Basehourlywageamt where the KNX_VIEW_WFCTTL_LABOR.ApplyDTM falls between the BASEWAGERTHIST.EffectiveDTM and BASEWAGERTHIST.ExpirationDTM.
 
If there is only one rate in the BASEWAGERTHIST it works fine, but if the table contains multiple rates it is only looking at the first effective dated row and if the KNX_VIEW_WFCTTL_LABOR.ApplyDTM does not fall between that row it stops evualating and returns a rate 0.00.
 
Does the above make sense?
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