====== pears.HideFromCombo ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create function "pears"."HideFromCombo"(
/* Application Maintained Function / Procedure - DO NOT EDIT*/
in "combovis" char(25) )
returns integer
begin
declare "staffcombovis" char(25);
declare "i" integer;
declare "c" char(1);
set "combovis" = "trim"("combovis");
if "isnull"("combovis",'') = '' then
return 0
end if;
select "trim"("combovisibility") into "staffcombovis" from "staff" where "staffid" = "userstaffid";
if "isnull"("staffcombovis",'') = '' then
return 0
end if;
set "i" = 1;
loop
set "c" = "substring"("combovis","i",1);
if "c" = '' then
return 1
end if;
if "staffcombovis" like '%'+"c"+'%' then
return 0
end if;
set "i" = "i"+1
end loop
end