====== pears.NetReportCandidateProgressHistory ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create procedure "pears"."NetReportCandidateProgressHistory"( in "pWebUserID" char(20) )
result( "Title__H" char(100),"Company_Name" char(100),"Vacancy_Name" char(100),"Start_Date" char(100),"Application_Date" char(100),"Outcome" char(100) )
begin
select distinct
'Application History',
"c"."name",
"v"."position" as "Position",
"isnull"(cast("dateformat"("v"."startdate",'Ddd dd Mmm yyyy') as char),'Not recorded') as "StartDate",
"isnull"(cast("dateformat"("pr"."actiondate",'Ddd dd Mmm yyyy') as char),'Not recorded') as "ActionDate",
"s"."name" as "State",
"v"."startdate" as "SortDate"
from "iqxnetuserlink" as "l"
key join "person" as "pe"
key join "progress" as "pr"
key join "vacancy" as "v"
key join "employment"
key join "company" as "c"
,"progress" as "pr"
join "status" as "s" on "s"."status" = "pr"."status" and "s"."type" = 'R'
where "l"."iqxnetuserid" = "pWebUserID"
order by "SortDate" desc
end /* DOC
2018-01-11 PC Combined two existing versions
*/
go
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetReportCandidateProgressHistory" IS
{create PROCEDURE pears."NetReportCandidateProgressHistory"(in pWebUserID char(20))
RESULT(Title__H char(100),Company_Name char(100),Vacancy_Name char(100),Start_Date char(100),Application_Date char(100),Outcome char(100) )
BEGIN
select distinct
'Application History',
c.name,
v.position as Position,
isnull(cast(dateformat(v.startdate,'Ddd dd Mmm yyyy') as char),'Not recorded') as StartDate,
isnull(cast(dateformat(pr.actiondate,'Ddd dd Mmm yyyy') as char),'Not recorded') as ActionDate,
s.name as State,
v.startdate as SortDate
from
iqxnetuserlink l
key join person pe
key join progress pr
key join vacancy v
key join employment
key join company c,
progress pr
join status s on s.status=pr.status and s.type='R'
where
l.iqxnetuserid=pWebUserID
order by
SortDate desc
END
/* DOC
2018-01-11 PC Combined two existing versions
*/
}