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!

sum & total

Status
Not open for further replies.

bobmorane

Technical User
Jul 2, 2002
38
FR
hello
I have to deal with a daily report, in which all 24 hours are printed + a maximum/mean/sum as a total for the day

The only point where I have a problem is >>> i have hourly sums, and for the day i want to display the maximum sum (i.e. among the 24 sums i want the maximum)
How could I do this ?
Thx by advance
bob
 
Without seeing how your report is structured I am not sure if this will work. There may also be an easier way.

You could create a global numver variable say MaxHours

Insert a formula where the hourly sums are calculated,let the variable equal the amount and then only update when it encounters a higher value eg

@maxhours
whileprintingrecords;
global numbervar maxhours;
If {@sumhours} > maxhours then maxhours:= {@sumhours}

If you need to reset or display the variable then you will need to create two extra formulae, and insert at appropriatepoints within your report

@reset
global numbervar maxhours;

@display
global numbervar maxhours;

Hope this helps




 
hummm looks interesting but certainly it won't work, because I have 24 different formulas, not just 1 :(
Anyway i'll try your solution, after all i just have to create a new formula !
Thx
 
*gasp*
it does'nt work...
i think it is becasue i use 24 formulas (running totals, sum ; moment of evaluation is [...]hour(timestamp) = 1, 2, 3, etc...) instead of one
they are all displayed in the state page bottom (huh it's certainly a false translation from the french 'pied de page de l'état' >>> the last but one section ;) )
I can't place them in the details section because the database logs new entries every 10 seconds and i want hourly means, maxs, sums etc...
 
-correction-
forget what i said... it seems to work just with putting the @maxhours formula, no need of @display (moreover your @reset & @display formulas are the same :) )
thank you alot Ian
Bob
 
hum hum correction again...
this doesn't work... a new hour has started ans the formula simply takes into account the current hour, the maxhours formula is always overwrited
I'm going to try with arrays, and if possible i'll take the maximum of the array or something like that :)
later
bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top