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.GetPersonEmploymentHistory ====== <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"."GetPersonEmploymentHistory"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "InPersonID" char(20),in "Word" char(3) ) returns long varchar begin declare "EmploymentHistory" long varchar; declare "Tab" char(1); declare "NewLine" char(2); declare "LoopCounter" tinyint; -- Word does not like CR LF, just CR if "Word" = 'Yes' then set "NewLine" = "char"(13) else set "NewLine" = "char"(13)+"char"(10) end if; set "Tab" = "char"(9); set "LoopCounter" = 0; set "EmploymentHistory" = ''; for "fetchfor" as "fetchcursor" no scroll cursor for select "dateformat"("Employment"."StartDate",'Mmm yyyy')+"Tab"+"dateformat"("Employment"."LeaveDate",'Mmm yyyy') +"Tab"+"Company"."Name"+"Tab"+"Employment"."Position" as "NextLine" from "Employment" key join "Company" where "temp" = 0 and "Employment"."StartDate" is not null and "Employment"."PersonID" = "InPersonID" order by "Employment"."StartDate" desc for read only do if "LoopCounter" > 0 then set "EmploymentHistory" = "EmploymentHistory" || "NewLine" end if; set "EmploymentHistory" = "EmploymentHistory" || "NextLine"; set "LoopCounter" = "LoopCounter"+1 end for; return("EmploymentHistory") end </code> database/functions/pears_getpersonemploymenthistory.txt Last modified: 2026/08/07 19:24by 127.0.0.1