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

HELP URGENT! WhilePrintingRecords with error!!

Status
Not open for further replies.

mheilbut

Programmer
Apr 24, 2002
53
BR
Hi my formula is as follows:

WhilePrintingRecords;
NumberVar MyTotal;

MyTotal := MyTotal + (({?pro_men_par}/{@tot_op_pares})*{imb_rp_esti.op_qtd});

({?pro_men_par}/{@tot_op_pares})*{imb_rp_esti.op_qtd};

My total is summing wrong the result, I am resseting the variable in a group above putting MyTotal to 0.

Any help would be GREAT! I really need this done!
Thanks! Michel, São Paulo, Brazil
 
The varible seems to be not a global variable. Declare it as a global varible in group header. I hope you are doing this calc in detail section..

Mention clearly what is your problem.

Thanks
srini
 
How do I Declare it as a global varible in group header?
Michel, São Paulo, Brazil
 
I declared it as a Global variable now but nothing changed.
It seems to be counting the last register twice. Michel, São Paulo, Brazil
 
Group header
=============
WhilePrintingRecords;
GLOBAL NumberVar MyTotal = 0;

Detail section
==============
WhilePrintingRecords;
GLOBAL NumberVar MyTotal := MyTotal + (({?pro_men_par}/{@tot_op_pares})*{imb_rp_esti.op_qtd});
({?pro_men_par}/{@tot_op_pares})*{imb_rp_esti.op_qtd};

For the first time when u are accessing a vble in any section use Global. 2nd time not necessary.. (See above)..
Dont put any thing in footer bcz again in group header the variable Group header NumberVar MyTotal will be set to 0.

Thanks
Srini
 
I don't know if I am doing this wrong but it is not working.
Let me explain better:
I have two groups. My info are on the details and my some will be made in my group 2.

When I use this:
WhilePrintingRecords;
GLOBAL NumberVar MyTotal = 0;
as you told me, it brings me 'FALSE' as the values of the formula field of the group total.
How many diferent formulas do I need?

I am using one in the detail which is this:
WhilePrintingRecords;
GLOBAL NumberVar MyTotal := MyTotal + (({?pro_men_par}/{@tot_op_pares})*{imb_rp_esti.op_qtd});
({?pro_men_par}/{@tot_op_pares})*{imb_rp_esti.op_qtd};

And another in the group which is this:
WhilePrintingRecords;
GLOBAL NumberVar MyTotal;

Any ideas? Thanks! Michel, São Paulo, Brazil
 
GH -1
======

GH2
=============
WhilePrintingRecords;
GLOBAL NumberVar MyTotal = 0;

Detail section
==============
WhilePrintingRecords;
GLOBAL NumberVar MyTotal := MyTotal + (({?pro_men_par}/{@tot_op_pares})*{imb_rp_esti.op_qtd});
({?pro_men_par}/{@tot_op_pares})*{imb_rp_esti.op_qtd};

Forget about Group1..
 
This way, it brings me False in my group total. Using the same thing but resseting the variable alone in the group brings me a sum. But the sum it brings me is as if he was repeating the last register or adding 1 to the value.

Michel, São Paulo, Brazil
 
I found out exactly what is happening.
It is summing correctly but it is counting the last register twice.
Ex: My sum should add to 16.90 but adds to 18.90 and my last register is 2.00.
What can I do? Michel, São Paulo, Brazil
 
Paste the report here with some sample data.. what you exacltly requrie..
 
Always use ":=" in an expression to assign a value. You are getting "False" because an expression like "a = b" (with just the "=" sign is a boolean expression that evaluates to True or False.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top