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!

Summary Report

Status
Not open for further replies.

crystalbeginner15

Programmer
Sep 6, 2005
76
US
I am creating a summary report using CR11.
These are the columns for the report.
I have teo direction and eac direction has three lanes so basically I will get 6 rows of data.
Lane AmTotal AMAVg PMTotal PMAVG PeakAM

I have to calculate AM total which it total volume for
that lane from 1 am- 12PM and similarly PMTotal .I have written a fornula to calculate the AMtotal but its not giving the desired result here is the formula
we have time(hour_nbr) in our database as 0,100,200.......2300(24 hours)

WhilePrintingRecords;
numberVar totalVolume:=0;
numberVar endTime :=1200;
numberVar i= {TKO_HOUR_BY_CLASS_VW.HOUR_NBR};
for i:=0 to endTime step 100 Do
(
totalVolume :=totalVolume +{TKO_HOUR_BY_CLASS_VW.TOTAL_HRLY_VOLUME_NBR}
);
totalVolume

 
Posting example data and expected output is a much better idea than describing requirements and posting a faulty formula.

Why do you set i to a value and then the next line changes it?

Anyway, it looks like you want to multiply{TKO_HOUR_BY_CLASS_VW.TOTAL_HRLY_VOLUME_NBR}
by
({TKO_HOUR_BY_CLASS_VW.HOUR_NBR}/100)

So use that formnula:

{TKO_HOUR_BY_CLASS_VW.TOTAL_HRLY_VOLUME_NBR}
*
({TKO_HOUR_BY_CLASS_VW.HOUR_NBR}/100)

or perhaps one less, as in:

{TKO_HOUR_BY_CLASS_VW.TOTAL_HRLY_VOLUME_NBR}
*
(({TKO_HOUR_BY_CLASS_VW.HOUR_NBR}/100)-1)

If not, post specifics.

-k
 
I think you got wrong. If it was in java
I would have coded something like this
int totalVol;
for(int i=o;i<1200;i=i+100)
{
totalVol =totalVol+getTotalHourlyVolume
}

Basically I am trying to get the total Volume from 1AM to 12PM(midnight) so I am trying to loop through the time
and add the volume
 
Right, but you're adding the same thing over and over, it's less efficient and overly complicated. If you do it that way in Java, try asking a more senior developer to rewrite it for you in the method I've described, you won't need iterative processing.

A shame you won't post example data and expected output as requested.

Good luck.

-k
 
What do you mean by that. if you can help then pass helpful information .Don't try to pass comments.
 
I usually use the following style of logic for such a situation.


WhilePrintingRecords;

numbervar x;

If {table.field1}>=my1st_value and
{table.field1} <= my2nd_value then
x:=x+{table.field2} else x;

Hope it helps!!
 
I have the subreport like this.I have two groups first group direction and second group lane so I get 3 lanes in each direction

Lane AMTotal AMAvg PMTotal PMAVG
l1
l2
l3
l1
l2
l3

My main report looks like this
Date ln h1 h2 h3 h4 h5.................h24 total

Basically this report gives for each lane for each hour of the day how much was the volume

so to calculate the AMTotal I add the volume from(h1-h11) for that lane in that direction.

I tried to use the above formula but not getting the desired result for AMTotal in the subreport.

Please help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top