====== pears.GetContactEventCaption ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create function "pears"."GetContactEventCaption"(
/* Application Maintained Function / Procedure - DO NOT EDIT*/
in @ContactEventID char(20) )
returns char(250)
begin
declare @Caption char(250);
declare @PersonID char(20);
declare @VacancyID char(20);
declare @PlacementID char(20);
declare @ProgressID char(20);
declare @EmploymentID char(20);
declare @CompanyID char(20);
declare @CompanyName char(100);
declare @ApplicantName char(100);
declare @PositionName char(100);
declare @ContactName char(100);
declare @PlacementTerminology char(20);
select "PersonID","VacancyID","PlacementID","ProgressID","EmploymentID","cname","cpname","pname","Position","WPKMaintainGetSwitchValue"('PLACNAME','Global','L') into @PersonID,
@VacancyID,@PlacementID,@ProgressID,@EmploymentID,@CompanyName,@ContactName,@ApplicantName,@PositionName,
@PlacementTerminology from "ContactView"
where "ContactView"."ContactEventID" = @ContactEventID;
case
when @ProgressID is not null then
set @Caption = "string"(@ApplicantName,' progress re. ',@PositionName,' for ',@CompanyName)
when @PlacementID is not null then
set @Caption = "string"(@ApplicantName,' ',@PlacementTerminology,' as. ',@PositionName,' for ',@CompanyName)
when @VacancyID is not null then
set @Caption = "string"(@CompanyName,' - ',@ContactName,' re. ',@PositionName)
when @EmploymentID is not null and @PersonID is not null then
set @Caption = "string"(@CompanyName,' - ',@ContactName,' re. ',@ApplicantName)
when @EmploymentID is not null and @PersonID is null then
set @Caption = "string"(@CompanyName,' - ',@ContactName)
when @EmploymentID is null and @PersonID is not null then
set @Caption = "string"(@ApplicantName)
end case;
return @Caption
end