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

Problem with a summary -> Sum()

Status
Not open for further replies.

alfafa29

Technical User
Apr 5, 2006
4
0
0
CH
Hello,
I've got problem :-(

I create a formula call "tutu" with this code :

numberVar x:=0;
if PreviousIsNull ({Explorer.piece_id}) then
x := {Explorer.piece_surf_nette}
else
if Previous ({Explorer.piece_id})={Explorer.piece_id} then x:=0
else
x := {Explorer.piece_surf_nette};
x;

but I don't can do a summary on "tutu".
I don't understand why ?
Can somebody help me ?

thank's a lot
have a nice day
fabrice
 
You can only create summaries on database fields, SQL Expressions or First-pass formulas.(i.e. a formula evaluated WhileReadingRecords).
Your formula is evaluated in the second pass due to the use of the "Previous" and "PreviousIsNull" functions.
You could accumulate this value to another variable and then in another formula, show the results of that accumulation.

Code:
NumberVar accum ;
numberVar x:=0;
if PreviousIsNull ({Explorer.piece_id}) then
    x := {Explorer.piece_surf_nette}
else
    if Previous ({Explorer.piece_id})={Explorer.piece_id} then  x:=0
    else
        x := {Explorer.piece_surf_nette};
accum := accum + x ;
x;

Your display formula would look something like this:
Code:
WhilePrintingRecords ;
NumberVar accum;

If this value needs to be reset at a group level, create a Reset formula for the Group Header like this:
Code:
WhilePrintingRecords ;
If NOT InRepeatedGroupHeader then
(
NumberVar accum := 0;
)


Bob Suruncle
 
hello Bob Suruncle,

Thank's a lot for your reponse

have a nice day
bye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top