cancel
Showing results for 
Search instead for 
Did you mean: 

Need help in Formulas

Former Member
0 Kudos

Hi,

I written formula like this:

stringVar result;

numberVar pass;

numberVar fail;

if {@result} < 40 then

(result := "Fail";

fail := fail + 1)

else

(result:= "pass";

pass := pass + 1);

result;

Now i want, suppose if i have 'n' no.of peoples, then i have to get the no.of count for each pass and fail.

Eg: Pass 10

fail 5

Can anyone give solution?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member292966
Active Contributor
0 Kudos

Hi,

You're on the right track. What you want to do is called a running total. The only thing you need to add to your formula is:

WhilePrintingRecords;

at the beginning of your formula like:

WhilePrintingRecords; 
stringVar result;
numberVar pass;
numberVar fail;

if {@result} < 40 then
(result := "Fail"; 
fail := fail + 1)
else 
(result:= "pass";
pass := pass + 1);

result;

Now create a second formula like:

WhilePrintingRecords; 
NumberVar pass;
NumberVar fail; 

"Pass = " & ToText (pass, 0, "", "") & "Fail = " & ToText (fail, 0, "", ""); 

Your first formula should be on the Detail section where you want the variables to accumulate, you can format this formula to suppress if you don't want to see it. The second formula would be where you want to see the final total.

Good luck,

Brian

Edited by: Brian Dong on Oct 28, 2010 4:18 PM

Former Member
0 Kudos

Thks a lot.