Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Worked hours within specified date range

Status
Not open for further replies.

DannyBill

Technical User
Nov 21, 2005
14
US
I'm working on a report where I need to find the numbers of hours worked within a specified date range. This report will be used year after year so I'm wanting to declare start and end dates, then create formulas based off those to specify date range.
I've created a formula called Start date for the first week:
WhilePrintingRecords;
Shared DateTimeVar StartDate;
DateTimeVar EndDate;


StartDate := DateTimeValue (2005,02,20);
EndDate := DateTimeValue (2005,02,26);
0

Next I've created a formula for the second week to show hours worked:
WhilePrintingRecords;
DateTimeVar StartDate;
DateTimeVar EndDate;

if {VW_EmpJobs.EndDate} in dateTimeVar StartDate+7 to dateTimeVar EndDate +7
then {VW_EmpJobs.WorkedHours}
else 5555

All I get is 5555 in the details section for each job.
I will eventually create formulas to show hours worked for each week of the year using this formula if I can ever get it figured out.

Any help as to what I'm doing wrong would be appreciated.

Thanks,
Dan
 
It's often best to define requirements rather than demonstrating something that doesn't work.

Crystal version
Database/connectivity
Example data
Expected output

Are you familiar with parameters? Hardcoding dates is generally a bad idea.

Create a date range parameter.

In the Report->Edit Selection Formula place the following:

{VW_EmpJobs.EndDate} in {?MyDateRange}

Now you're limiting the data to whatever dates are entered in the parameter.

Next if you need to get hours by the week, group by the date and specify that the grouping is for each week.

Now you can just place the hours field in the details, right click it and select Insert->Summary->Sum and select for the group.

You can now suppress the details and you'll get weekly hours worked.

-k
 
Thanks for the help. Didn't mean to waste time, just thought someone may be able to point out what is wrong with the formula.

I have the report grouped by technicians, thus the hours worked formulas needs to go horizontally across report much like a cross tab.

Thanks again,

Dan
 
Insert a cross-tab into the technican group footer or header, and make the date the column por row, select group options and change it to be by week, then make the hours the summary field.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top