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

Number variable printing formula help 3

Status
Not open for further replies.

rinder

Technical User
Apr 2, 2001
7
CA
I've created the following conditional running total based upon what I've learned from other postings here......

whileprintingrecords;
numbervar ordrunningtotal;
if ({@OrdNo} <> previous ({@OrdNo}) )
then
ordrunningtotal:=ordrunningtotal + {@OrdTot}
else
ordrunningtotal := ordrunningtotal

the problem is that this formula excludes the very first record from the running total, can anyone help?

Thanks in advance for your help.

N
 
Try:

if not (onfirstrecord) and
{@OrdNo} <> previous ({@OrdNo})
then//etc.

-LB
 
lbass is on the right track, but I think that'll still excluse the first record from the total.

What you're after looks more like:

whileprintingrecords;
numbervar ordrunningtotal;

If OnFirstRecord
Then
ordrunningtotal:=ordrunningtotal + {@OrdTot}
Else
if ({@OrdNo} <> previous ({@OrdNo}) )
then
ordrunningtotal:=ordrunningtotal + {@OrdTot}
else
ordrunningtotal := ordrunningtotal;

Naith
 
Why don't you just change the syntax slightly to :

whileprintingrecords;
numbervar ordrunningtotal;
if ({@OrdNo} = previous ({@OrdNo}) )
then
ordrunningtotal := ordrunningtotal
else
ordrunningtotal:=ordrunningtotal + {@OrdTot}

The first value will not meet the criteria, therefore being correct.


Reebo
Scotland (Sunny with a Smile)
 
Oops. Yes, I should have said:

if onfirstrecord or
(not (onfirstrecord) and
{@OrdNo} <> previous ({@OrdNo}))
then//etc.

-LB
 
Thanks all, lbass' formula worked. I tried Reebo99's but I still had the same problem but I appreciate the assistance non the less.

Regards,

Rinder
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top