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!

Getting a previous value and makeing it reset after each group 1

Status
Not open for further replies.
Apr 18, 2007
209
US
Friends need help on doing a running total like reset on Previous function
Example:
AA CA 123
AA CA 101
AA CA 341
AA MD 231
AA MD 222

should be shown as

AA CA
AA CA 123
AA CA 101
AA MD
AA MD 231
1st and 2nd fields are groups. and first value of previous should be null. Any help would be great.
 
I assume that:
> Group 1 is the 1st column;
> Group 2 is the 2nd column;
> The 3rd column (referred to in my formula as {Table.FLD3}) is numeric and not text,

and tackled it this way:

Create the following formula and place in in GH2:
Code:
WhilePrintingRecords;
Global NumberVar ROW := 0

Then Replace {Table.FLD3} with the following formula:

Code:
WhilePrintingRecords;
Global NumberVar ROW := ROW + 1;

If      ROW = 1
Then    0
Else    Previous({Table.FLD3});

This will return a zero for the first row of each group. Add conditional suppression of: CurrentFieldValue = 0

If {Table.FLD3} is text, replace "Then 0" with "Then ''", and omit the conditional suppression.

Hope this helps.

Cheers
Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top