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.FormatCompanyPersonAddress ====== <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"."FormatCompanyPersonAddress"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "ReqEmploymentID" char(20),in "Capitalise" smallint,in "Style" char(1) ) returns char(400) begin declare "FormattedAddress" char(400); declare "IncPosition" smallint; declare "IncDept" smallint; declare "PersonName" char(30); declare "CompanyName" char(60); declare "Post" char(50); declare "Dept" char(30); declare "NewLine" char(2); declare "ReqCoID" char(20); /* Decide whether to use CR/LF or comma as seperator */ if "Style" = 'B' then set "NewLine" = "char"(13)+"char"(10) elseif "Style" = 'L' then set "NewLine" = ', ' end if; /* Get option settings for Position & Department from params */ select first "PositionInAddr","DeptInAddr" into "IncPosition","IncDept" from "Params"; /* Get Company & Person details */ select "Person"."Name","Company"."Name","Employment"."Position","Employment"."Department","Employment"."CompanyID" into "PersonName", "CompanyName","Post","Dept", "ReqCoID" from "Pears"."Employment" key join("Pears"."Person","Pears"."Company") where "Employment"."EmploymentID" = "ReqEmploymentID"; /* Initialise the address */ set "FormattedAddress" = "PersonName"+"NewLine"; /* Add Position if required */ if "isnull"("IncPosition",0) = 1 and "length"("trim"("Post")) > 0 then set "FormattedAddress" = "FormattedAddress"+"Post"+"Newline" end if; /* Add department if required */ if "isnull"("IncDept",0) = 1 and "length"("trim"("Dept")) > 0 then set "FormattedAddress" = "FormattedAddress"+"Dept"+"Newline" end if; /* Get the rest of the address */ set "FormattedAddress" = "FormattedAddress"+"CompanyName"+"NewLine"+"FormatCompanyAddress"("ReqCoID","Capitalise","Style"); return("FormattedAddress") end </code> database/functions/pears_formatcompanypersonaddress.txt Last modified: 2026/08/07 19:24by 127.0.0.1