Link to home
Start Free TrialLog in
Avatar of angel7170
angel7170Flag for United States of America

asked on

NEXT and ONLASTRECORD Function in Crytsal Reports

Hello,
I am using the formulas to do a count based on the condition below. The issue is on the last record, if the condition is true, it displays nothing on the detail section and at the group footer it doesn't count the last record. I undersatand it is  because I am using "Next" in my formula. What should I do get the last record counted when the condition is true. please assist

@Count NPC Resolved
 
WhilePrintingRecords;
Global NumberVar TotalNPC;
 
if {HPD_Search_Assignment_Logs.Assigned_Group} = "NPC" 
and {HPD_Search_Assignment_Logs.Status} in ["Resolved", "Closed"] and
{HPD_Search_Assignment_Logs.Incident_Number} <> next ({HPD_Search_Assignment_Logs.Incident_Number})
then 
(
   TotalNPC := TotalNPC + 1;
 TotalNPC
)
 
 
@ Count NPC Resolved Reset
WhilePrintingRecords;
Global NumberVar TotalNPC:= 0;
 
 
@Count NPC Resolved Footer
WhilePrintingRecords;
Global NumberVar TotalNPC;
If TotalNPC = 0 then
   0
else
   TotalNPC

Open in new window

Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

I assume we are talking about...
"TotalNPC := TotalNPC + 1;"

Are you saying that you will always want to count the last record or are there still conditions that must apply?
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of angel7170

ASKER

Thank you mlmcc. It worked.