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

Count # of days in month with data - HELP !!!!! 1

Status
Not open for further replies.

lndoan

IS-IT--Management
Jun 30, 2005
28
US
I have a report that displays data daily for each month. In the group footer, the data is summarized. Some of the days have 0 data and most of data > 0. I like to count the number of days that consist of data > 0. I tried numerous formulas wihout success. An example:

whileprintingrecords;
numbervar countdays;

if Sum ({@Pax01},{TRIP_MAIN_OPS.INBOUND_OUTBOUND}) > 0 then
countdays:= count ({@Pax01})
else if Sum ({@Pax02},{TRIP_MAIN_OPS.INBOUND_OUTBOUND}) > 0 then
countdays:= count ({@Pax02})
else if Sum ({@Pax03},{TRIP_MAIN_OPS.INBOUND_OUTBOUND}) > 0 then
countdays:= count ({@Pax03})
else if Sum ({@Pax04},{TRIP_MAIN_OPS.INBOUND_OUTBOUND}) > 0 then
countdays:= count ({@Pax04})
else
0... so on....

Any assistance is greatly appreciated
 
Where is this formula being used?

What's in @Pax01?

Please be specific as to what "with no success" means, does it error, return zero, wrong numbers, or?

The formula looks pretty good, try adjusting to:

if Sum ({@Pax01},{TRIP_MAIN_OPS.INBOUND_OUTBOUND}) > 0 then
countdays:= Countdays+1
else if Sum ({@Pax02},{TRIP_MAIN_OPS.INBOUND_OUTBOUND}) > 0 then
countdays:= Countdays+1
etc...

Hard to say as I don't know where thsi formula is, nor what's in @paxXX

-k

-k
 
@Pax01 through @Pax31 are days in a month.

if Day ({RPT_TRIPS.Trip Date})=1 then
formula = {RPT_TRIPS.Passengers}
else
formula = 0
end if

I just ran this formula and it works BUT only for the first group of trains. The second group of trains had weird numbers where it should be the same as the first group.

if Sum ({@Pax01}) > 0 then
countdays:= count ({@Pax01},{RPT_TRIPS.Schedule ID})
else if Sum ({@Pax02}) > 0 then
countdays:= count ({@Pax02},{RPT_TRIPS.Schedule ID})
else if Sum ({@Pax03}) > 0 then
countdays:= count ({@Pax03},{RPT_TRIPS.Schedule ID})
else if Sum ({@Pax04}) > 0 then
countdays:= count ({@Pax04},{RPT_TRIPS.Schedule ID})
else if Sum ({@Pax05}) > 0 then
countdays:= count ({@Pax05},{RPT_TRIPS.Schedule ID})

so on for 31 days....

Thanks
 
You would be better off not using these date specific formulas. If you inserted a group on {RPT_TRIPS.Trip Date}, you could then create a formula like the following:

//{@notzero}:
if sum({RPT_TRIPS.Passengers},{RPT_TRIPS.Trip Date}) > 1 then 1

Then create two additional formulas:

//{@accum} to be placed in the group header or footer for the date group:
whileprintingrecords;
numbervar sumdays := sumdays + {@notzero};

//{@display} to be placed in the report footer:
whileprintingrecords;
numbervar sumdays;

If you want to display this as an outer group subtotal,e.g.,month, not a report total, then add a reset formula in the group header of the outer group:

//{@reset}:
whileprintingrecords;
numbervar sumdays := 0;

-LB
 
This is helpful. I was able to get the days correctly in the report footer. Let's see if I can get the rest of the formula to make this entire report work right. Thanks and will let you know if I run into problems which I might because this report has gone beyond complex.

- Linda
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top