Show pageOld revisionsBacklinksExport to PDFFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pears.ComplianceScore ====== <WRAP center round info> Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. </WRAP> ===== Original SQL ===== <code sql> create function "pears"."ComplianceScore"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "pPersonID" char(20),in "pVacancyID" char(20) default null ) returns double begin declare "act" double; declare "poss" double; declare "pComplianceDomainID" char(20); declare "pClientCode" char(12); declare "pDate" date; declare "pDeptID" char(2); set "act" = 0; set "poss" = 0; if "pVacancyID" is not null then select "v"."ComplianceDomainID","v"."StartDate","v"."DepartmentID","c"."TempComplianceCode" into "pComplianceDomainID","pDate","pDeptID","pClientCode" from "vacancy" as "v" key join "employment" join "company" as "c" where "v"."vacancyid" = "pVacancyID"; if "pComplianceDomainID" is null then select first "ComplianceDomainID" into "pComplianceDomainID" from "ComplianceDomain" where "DepartmentID" = "pDeptID" and "Name" like 'Default%' and("ClientTempComplianceCode" is null or "ClientTempComplianceCode" = "pClientCode") order by "ClientTempComplianceCode" desc,"Name" asc end if; if "pComplianceDomainID" is null then return 0 end if end if; for "PFOR" as "PCUR" no scroll cursor for select "AchievedScore","Score" from "ComplianceTable"("pPersonID","pComplianceDomainID","pDate","pClientCode") for read only do set "act" = "act"+"isnull"("AchievedScore",0.0); set "poss" = "poss"+"isnull"("Score",0.0) end for; if "poss" <= 0 then return 0 else return("act"/"poss")*100.0 end if end </code> database/functions/pears_compliancescore.txt Last modified: 2026/08/07 19:24by 127.0.0.1