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

Count mode values for pay period

Status
Not open for further replies.
May 5, 2000
168
US
I have a table for tracking transportation mode to work for each pay period. There are five modes 1=Transit, 2=carpool, 3=bicycle, 4=walk, 5=vanpool
The pay period database fields are below. A number is entered for each day representing the mode. I would like my report to count the modes for each pay period.

Wk_1_Sun char 1 1
Wk_1_Mon char 1 1
Wk_1_Tues char 1 1
Wk_1_Wed char 1 1
Wk_1_Thurs char 1 1
Wk_1_Fri char 1 1
Wk_1_Sat char 1 1
Wk_2_Sun char 1 1
Wk_2_Mon char 1 1
Wk_2_Tues char 1 1
Wk_2_Wed char 1 1
Wk_2_Thurs char 1 1
Wk_2_Fri char 1 1
Wk_2_Sat char 1 1
 
if the report is show one pay period each time then set up a record selection to restrict it to one pay period. Create a parameter to prompt for the pay period and use itin the record selection. Then create 5 running total fields which count the mode field when the mode value is equal to 1,2,3,4 or 5 and place them in the report footer.

If the report is to report on multiple pay periods, insert a group on the payperiod, create the five running totals as above, but set them to reset each ay period group and place them in the group footer.
 
Thanks, can you give me an example of how to create a running total with a count in the group. I'm new to CR and I'm using the interface in VB.NET. There is not a good help on this. I'll look through over postings to see if I can find something similar.
 
I think you just need to group on pay period, and then insert a group on mode. Then right click on a recurring field and insert a count at the mode group level.

-LB
 
I have create a group on the field "PayPeriod". It seems that I should be able to create a formula like this for each mode.

NumberVar tot1sun1 := 0;
NumberVar tot1mon1 := 0;


If ({ECAPParticipate.Wk_1_Sun}= "1") Then
tot1sun1 := count({ECAPParticipate.Wk_1_Sun})
else
If ({ECAPParticipate.Wk_1_Mon}= "1") Then
tot1mon1 := count({ECAPParticipate.Wk_1_Mon})

etc.

I am getting skewed results. I'm new at this so I'm sure that my programming is not correct. Can someone give me some guidance. Thank you.
 
No, I don't think you need a formula. Insert a group on payperiod and then a second group on mode. Then just place a recurring field in the detail section, right click on it, and insert a summary (count) at the mode group level.

-LB
 
This will only count one field such as Wk_1_Sun. I need to count all 14 of the fields and get one total for each mode. How can your method work.
 
Also, can you create a group that is not associated with a database field. I do not have a field, Mode.
 
Okay, I see now that these are separate fields. Are you saying that the field {Wk_1_Sun} holds the mode value? If these are all separate fields, then use a formula like:

stringvar array x := [{Wk_1_Sun}, {Wk_1_Mon}, etc.];
numbervar i;
numbervar j := ubound(x);
numbervar mode1 := 0;
numbervar mode2 := 0;
numbervar mode3 := 0;
numbervar mode4 := 0;
numbervar mode5 := 0;

for i := 1 to j do(
if x = "1" then
mode1 := mode1 + 1;
if x = "2" then
mode2 := mode2 + 1;
if x = "3" then
mode3 := mode3 + 1;
if x = "4" then
mode4 := mode4 + 1;
if x = "4" then
mode4 := mode4 + 1
);

Then reference the mode results in separate formulas:

whileprintingrecords;
numbervar mode1;

-LB
 
Thank you very much

I'm goint to try this now and will get back to you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top