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.PersonKeyWordsUpdate ====== <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 procedure "pears"."PersonKeyWordsUpdate"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in @ResetAll tinyint default 0 ) begin if @ResetAll = 0 then update "PersonKeyWords" set "StandardKeyWords" = (select "string"("p"."salutation",' ',"p"."Surname",' ',"p"."ForeNames",' ',"p"."AppNumber",' ',"p"."Addr1",' ',"p"."Addr2",' ',"p"."Addr3",' ',"p"."Town",' ',"p"."County",' ',"p"."PostCode",' ',"PayrollNumber",' ',"NI",' ', (select "list"("n"."number",' ') from "Phone" as "n" where "n"."Who" = 'P' and "n"."number" like '% %' and "n"."WhoID" = "p"."PersonID"),' ', (select "list"("replace"("n"."number",' ',''),' ') from "Phone" as "n" where "n"."Who" = 'P' and "n"."WhoID" = "p"."PersonID")) from "Person" as "p" where "p"."PersonID" = "PersonKeyWords"."PersonID"), "TagKeyWords" = "nullif"("PersonKeyWordsQuestion"("PersonKeyWords"."PersonID"),''), "CustomKeyWords" = "nullif"("PersonKeyWordsCustom"("PersonKeyWords"."PersonID"),''), "RefreshRequired" = 0, "CustomRefreshRequired" = 0, "TagRefreshRequired" = 0 // this is included abouve, so does not need to be done again where "RefreshRequired" = 1; // carry out any tag only updates required update "PersonKeyWords" set "TagKeyWords" = "PersonKeyWordsQuestion"("PersonKeyWords"."PersonID"), "TagRefreshRequired" = 0 where "TagRefreshRequired" = 1; update "PersonKeyWords" set "CustomKeyWords" = "nullif"("PersonKeyWordsCustom"("PersonKeyWords"."PersonID"),''), "CustomRefreshRequired" = 0 where "CustomRefreshRequired" = 1 elseif @ResetAll = 1 then update "PersonKeyWords" set "RefreshRequired" = 1 // All records will be refreshed on the next triggering of the procedure (normally by the event) end if end go COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."PersonKeyWordsUpdate" IS {create procedure PersonKeyWordsUpdate /* Application Maintained Function / Procedure - DO NOT EDIT*/ (IN @ResetAll tinyint default 0) begin if @ResetAll = 0 then update PersonKeyWords set StandardKeyWords = (select string(p.salutation, ' ' ,p.Surname,' ',p.ForeNames,' ',p.AppNumber,' ',p.Addr1,' ',p.Addr2,' ',p.Addr3,' ',p.Town,' ',p.County,' ',p.PostCode, ' ', PayrollNumber, ' ', NI, ' ', (select list(n.number,' ') from Phone n where n.Who = 'P' and n.number like '% %' and n.WhoID = p.PersonID), ' ', (select list(replace(n.number,' ',''),' ') from Phone n where n.Who = 'P' and n.WhoID = p.PersonID)) from Person p where p.PersonID = PersonKeyWords.PersonID), TagKeyWords = nullif(PersonKeyWordsQuestion(PersonKeyWords.PersonID),''), CustomKeyWords = nullif(PersonKeyWordsCustom(PersonKeyWords.PersonID),''), RefreshRequired = 0, CustomRefreshRequired = 0, TagRefreshRequired = 0 // this is included abouve, so does not need to be done again where RefreshRequired = 1; // carry out any tag only updates required update PersonKeyWords set TagKeyWords = PersonKeyWordsQuestion(PersonKeyWords.PersonID), TagRefreshRequired = 0 where TagRefreshRequired = 1; update PersonKeyWords set CustomKeyWords = nullif(PersonKeyWordsCustom(PersonKeyWords.PersonID),''), CustomRefreshRequired = 0 where CustomRefreshRequired = 1; elseif @ResetAll = 1 then update PersonKeyWords set RefreshRequired = 1; // All records will be refreshed on the next triggering of the procedure (normally by the event) end if; end } </code> database/procedures/pears_personkeywordsupdate.txt Last modified: 2026/08/07 19:24by 127.0.0.1