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!

Stop formula executing in Report Footer

Status
Not open for further replies.

jannoth

MIS
Oct 9, 2007
60
CA
I have a formula in GF1 (@CountNewLeanersThisYr):

Numbervar CntNewLearners;
If Maximum ({@DidCourseThisYr}, {vRepPeople.PeopleID}) = 1 and
Maximum ({@DidCourseWithin2Yrs}, {vRepPeople.PeopleID}) = 0 Then
CntNewLearners:= CntNewLearners + 1;

I'm counting learners who studied this year but havn't studied for the preceding two yrs (it makes them "new" for certain returns).

Problem : when I refer to the CntNewLearners in the report footer area, it increments the value by one.

If I display a formula containing only "Numbervar CntNewLearners" it still increments.

What am I doing wrong??

Thanks!
 
Your display formula should look like this:

whileprintingrecords;
numbervar CntNewLearners;

You must remove your accumulation formula from the report footer for this to work properly.

-LB
 
Hi lbass, that's exactly what my display formula looks like (stupid me ... I forgot to mention the "WhilePrintingRecords" bit, sorry) [blush]

In any event ... you just helped me find the cause [dazed]

The RF section also contains a running total called {#Tot_Learners} (all learners in a particular year).
Deleting it from the report doesn't fix the problem, but ...

Deleting a percentage formula does stop CntNewLearners being incremented once too often. So the real question is why??

Here's the percentage formula:

If {@CountNewLeanersThisYr} > 0 Then {@DISPCountNewLeanersThisYr} / {#Tot_Learners} *100

To explain (sorry if I'm teaching grandma to suck eggs): if there are any learners in the report (to avoid errors caused by nulls) then divide the display formula (ie per your last suggestion) into the running total of all learners).

Am I confusing matters even more?

What should I do?

Thanks again!
 
You should be referenceing the display formula, not the accumulation formula in the percentage. Also you should be checking the denominator for zero values, not the numerator. If the rt can be null, you should explicitly check for that:

whileprintingrecords;
numbervar CntNewLearners;
if isnull({#Tot_Learners}) or
{#Tot_Learners} = 0 then
0 else
CntNewLearners%{#Tot_Learners}

-LB
 
Fantastic, thanks [bigsmile]

Simply changing from denoninator to numerator (once I'd worked out which was which!!) did the trick.

It's obvious to me now.

I've adopted your other suggestion about avoiding nulls.

I'm as grateful to you as as always lbass.

J
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top