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

Accumulator Formula

Status
Not open for further replies.

mmt4331

Programmer
Dec 18, 2000
125
US

The below formula I am putting in the RF section of the report. It is to calculate how many times the field has 15 characters within it. It is showing up blank. Here is the formula. I have also tried WhilePrintingRecords and WhileReadingRecords but that doesn't work as well. Can anyone help me? Thx.

NumberVar counter;

if length({Personal Info.Employer}) = 15 then
(
counter := counter + 1
);
counter;



 
If you place that formula in the Report Footer, it's only going to evaluate once. And if the last record didn't have 15 characters in it, then 'Counter' will produce nothing.

Keep WhilePrintingRecords in.

Place the formula in whatever section has the {Personal Info.Employer} field.

Call the formula in the Report Footer with:

WhilePrintingRecords
NumberVar Counter;

Naith
 
Consider a Running Total:

Set it to Count the name field, and then in the Evaluate->Use a Formula place:

len(trim({Personal Info.Employer})) > 15

Just place the Running Total in the RF.

I prefer to use them for most summaries as you don't have to create 2 formulas, and hide one in the details section.

Also, if you use Naith's example, change:

NumberVar Counter;

to:

Global NumberVar Counter;

in both formulas.

-k kai@informeddatadecisions.com
 
Implicit variables are already global by default.
 

Thx! It worked! I did create a running total formula w/in the same section as {Personal Info.Employer} (detail section)...for some odd reason, even though it works, for example, it gives the same number as the one above it even though it didn't (and shouldn't) increment. Remember...I'm trying to count the companies that has 15 characters w/in it. Here is what I'm getting:

Running Total Company

1 Quick Solutions
ARC
2 Quick Solutions
2 Cyber

Grand Total: 2






 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top