I'm using Crystal Reports. I want to count all cells having "Yes" and all cells having "No" for each line as in following image:
You'll need to count it using custom formulas. Create formula fields in report design, namely ff_Evaluate
, ff_Yes
, ff_No
and set their values in formula editor like this:
ff_Evaluate (check each column and add to yes or no var)
WhilePrintingRecords;
numberVar YesCount := 0;
numberVar NoCount := 0;
if {table.T0} = "Yes" then
YesCount := YesCount + 1
else if {table.T0} = "No" then
NoCount := NoCount + 1;
if {table.T1} = "Yes" then
YesCount := YesCount + 1
else if {table.T1} = "No" then
NoCount := NoCount + 1;
...
...
if {table.Tn} = "Yes" then
YesCount := YesCount + 1
else if {table.Tn} = "No" then
NoCount := NoCount + 1;
ff_Yes
WhilePrintingRecords;
EvaluateAfter ({@ff_Evaluate});
numberVar YesCount;
ff_No
WhilePrintingRecords;
EvaluateAfter ({@ff_Evaluate});
numberVar NoCount;
Now place these formula fields in your Details section and Suppress ff_Evaluate
by Right Click
on it, point to Format Field
and then in the Common
tab select Suppress