0
votes

I have some view from database

here the view

select main.processId,
main.departmentname as DepartmentName,
dpaudit.DropdownlistName DdlAudit, 
main.PICForAudit,
main.DateOfAudit,
main.ReferenceDetail,
main.finding as Finding,
CASE dpfinding.DropdownlistName WHEN 'RFI' THEN 'X' ELSE '' END AS IsRFi,
CASE dpfinding.DropdownlistName WHEN 'Minor NC' THEN 'X' ELSE '' END AS IsMinor,
CASE dpfinding.DropdownlistName WHEN 'Major NC' THEN 'X' ELSE '' END AS IsMajor,
iird.description as Description,
CASE spdl.DropdownlistName WHEN 'High Priority' THEN 'X' ELSE '' END AS High,
CASE spdl.DropdownlistName WHEN 'Medium Priority' THEN 'X' ELSE '' END AS Medium,
CASE spdl.DropdownlistName WHEN 'Low Priority' THEN 'X' ELSE '' END AS Low,
bc.DropdownlistName as RootCause,
iird.CorrectiveActionPlan,
iird.picResponsibilityName,
iird.TargetDateCompletion,
pos.positionname as Position
from SheAuditMain main 
join IncidentInvestigationRecommendationDescription iird on main.ProcessId = iird.PIDSource
join SheProgramsDropdownlistMenu spdl on spdl.dropdownlistcode = iird.priority
join SheProgramsDropdownlistMenu dpaudit on main.TypeOfAudit = dpaudit.DropdownlistCode 
join SheProgramsDropdownlistMenu dpfinding on main.TypeOfFinding = dpfinding.DropdownlistCode 
join SheProgramsDropdownlistMenu bc on bc.dropdownlistcode = iird.basiccause
join vwusrposOs pos on iird.picResponsibility = pos.positionid

and then i want to create report using crystal report so the report look like this

https://ibb.co/eq924T

as we can see count of the priority [L,M,H] isn't correct,

i do some code for that first, i add running total field from each field [L,M,H] and then i write code in formula

example for formula field for field high, because low and med is the same

Local numberVar i := 0;
Local numberVar TotalHigh := 0;

for i := 0 to {#RTotalHigh} - 1 do   <{#RTotalHigh} coming from running total
    (
    if ({VwCheckPrior.High} = 'X') then
        TotalHigh := TotalHigh + 1
    else 
        0 
     );
TotalHigh  

how do i display the correct calculation ?

[sorry for the image, i forgot my account before]

1
oh, fogot to add, from running total <{#RTotalHigh}, all the H,M,L is display the same result which is '2'Heinrich

1 Answers

0
votes

I think you should use NULL instead off empty string ('') in that CASE, because when you use empty string it will be count in total