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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to combine hours by work class

Status
Not open for further replies.

PBTX

Technical User
Nov 1, 2011
17
0
0
US
Below is how my report is displaying. I need to combine all the driver hours into a total. I have tried sum, total and I must not be using the right codes, as it gives me a total underneath the individual total.

Period_End_Date Race Job_Number WorkClass Hours
5/28/2011 C 4250 Driver 3.50

05/29/2011 H Driver 7.00

05/30/11 ASAM Driver 6.00

05/28/11 C Operator 3.00

05/29/11 C Operator 6.00

05/29/11 C Laborer 2.50

Thank you,
 
Create a formula like this:

if {table.workclass} = "Driver" then
{table.hours}

Place it in the detail section and insert a sum on it at the group or report level.

Alternatively, if you want sums by each workclass, insert a group on that field and insert a sum on hours at the workclass group level.

-LB
 
Did not work. The work class is actually the union code converted to text.
if isnull({PR_Time_Card_History_MC.Union_Code}) then
"" else
(
select mid({PR_Time_Card_History_MC.Union_Code},2,1)
case "D" : "Driver"
case "O" : "Operator"
case "L" : "Laborer"
case "F" : "Foreman"
)

If I attempt to add it in here it gives me error messages. If I add it to Group 1 it moves all my union codes to the left
0.00
SCHIJON
1.50
SCHIJON
2.00
SCHIJON
SCHIJON C 5/28/2011 12:00:00AM 4250 Driver 3.50
0.00
LAFATRA
1.08
LAFATRA
LAFATRA C 6/11/2011 12:00:00AM 4250 Driver 1.08
0.00
NAVAALB
1.00
NAVAALB
NAVAALB H 6/18/2011 12:00:00AM 4250 Driver 1.00
0.00
FISHCOR
1.00
FISHCOR
FISHCOR C 5/28/2011 12:00:00AM 4250 Driver 1.00
0.00
RAVERON
0.50
RAVERON
1.00
RAVERON
1.50
RAVERON
2.00
RAVERON
2.50
RAVERON
3.00
RAVERON
3.50
RAVERON
4.00
RAVERON
4.50
RAVERON
5.00
RAVERON
7.00
RAVERON
Employee_Code Race Period_End_Date Job_Number Work Class Hours
4250 MEUR
8.00
RAVERON
10.00
RAVERON
RAVERON C 6/18/2011 12:00:00AM 4250 Foreman 176.00

Arrgh!


 
I have no idea what you are saying about things moving to the left. You should be referencing your formula--I'll call it {@unioncode}:

if {@unioncode} = "Driver" then
{table.hours}

Place this formula in the detail section->right click on it->insert summary->sum and choose the group and/or report level where you want the results.

-LB
 
The following is my formula in the @union

if isnull({PR_Time_Card_History_MC.Union_Code}) then
"" else
(
select mid({PR_Time_Card_History_MC.Union_Code},2,1)
case "D" : "Driver"
case "O" : "Operator"
case "L" : "Laborer"
case "F" : "Foreman"
);
if {PR_TIME_CARD_HISTORY_MC.Union_Code} = "Driver" then
{PR_TIME_CARD_HISTORY_MC.Hours};
if {PR_TIME_CARD_HISTORY_MC.Union_Code} = "Laborer" then
{PR_TIME_CARD_HISTORY_MC.Hours};

I have Group header 1 which is Job Number
Group Header 2 which is Employee code.

Thank you, for your help with this.


if {PR_TIME_CARD_HISTORY_MC.Union_Code} = "Operator" then
{PR_TIME_CARD_HISTORY_MC.Hours}

the results = all my union codes change to 0.00
 
I don't know what the end product is supposed to look like, but instead of the approach you are using, try adding the following formula as a row field in a crosstab that you insert in the report footer, and use sum of {PR_TIME_CARD_HISTORY_MC.Hours} as the summary field, with no column field:

if isnull({PR_Time_Card_History_MC.Union_Code}) then
"" else
(
select mid({PR_Time_Card_History_MC.Union_Code},2,1)
case "D" : "Driver"
case "O" : "Operator"
case "L" : "Laborer"
case "F" : "Foreman"
)

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top