====== pears.NetDashboardObjects ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== create procedure "pears"."NetDashboardObjects"( in "pWebUserID" char(20),in "pDashboardObjectID" char(20) default null,in "pAll" smallint default null,in "pDashboard" smallint default null,in "pHomePage" smallint default null ) result( "DashboardObjectID" char(20),"UserName" char(60),"Type" char(50),"Title" char(250),"Descriptor" long varchar,"Shared" smallint,"AccessLevel" smallint,"OnDashboard" smallint,"OnHomePage" smallint ) // IQXWeb begin declare "uStaffID" char(20); declare "uLevel" smallint; select "u"."staffid","isnull"("s"."ReportView",0) into "uStaffID","uLevel" from "iqxnetuser" as "u" key join "staff" as "s" where "u"."iqxnetuserid" = "pWebUserID"; select "d"."DashboardObjectID",'' as "UserName","d"."Type","d"."Title","d"."Descriptor","d"."Shared","d"."AccessLevel","dd"."onDashboard","dd"."onHomePage" from "DashboardObject" as "d" left outer join "DashboardDisplayedObject" as "dd" on "dd"."DashboardObjectID" = "d"."DashboardObjectID" and "dd"."staffid" = "uStaffid" where "d"."staffid" = "uStaffID" and("d"."DashboardObjectID" = "pDashboardObjectID" or "pAll" = 1 or "pDashboard" = "dd"."onDashboard" or "pHomePage" = "dd"."onHomePage") union all select "d"."DashboardObjectID","s"."name" as "UserName","d"."Type","d"."Title","d"."Descriptor","d"."Shared",null,"dd"."onDashboard","dd"."onHomePage" from "DashboardObject" as "d" key join "staff" as "s","DashboardObject" as "d" left outer join "DashboardDisplayedObject" as "dd" on "dd"."DashboardObjectID" = "d"."DashboardObjectID" and "dd"."staffid" = "uStaffid" where "d"."staffid" <> "uStaffID" and "d"."Shared" = 1 and "uLevel" >= "isnull"("d"."AccessLevel",0) and("d"."DashboardObjectID" = "pDashboardObjectID" or "pAll" = 1 or "pDashboard" = "dd"."onDashboard" or "pHomePage" = "dd"."onHomePage") and "isnull"("s"."divisionid",'') = any(select "DivisionID" from "DashboardStaffDivisions"()) order by "UserName" asc,"Title" asc end go COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetDashboardObjects" IS {create procedure pears.NetDashboardObjects( in pWebUserID char(20), in pDashboardObjectID char(20) default null, in pAll smallint default null , in pDashboard smallint default null , in pHomePage smallint default null ) result(DashboardObjectID char(20), UserName char (60), Type char(50), Title char(250), Descriptor long varchar, Shared smallint, AccessLevel smallint, OnDashboard smallint, OnHomePage smallint) // IQXWeb begin declare uStaffID char(20); declare uLevel smallint; select u.staffid, isnull(s.ReportView,0) into uStaffID, uLevel from iqxnetuser u key join staff s where u.iqxnetuserid = pWebUserID; select d.DashboardObjectID,'' as UserName, d.Type, d.Title, d.Descriptor, d.Shared, d.AccessLevel, dd.onDashboard, dd.onHomePage from DashboardObject d left outer join DashboardDisplayedObject dd on dd.DashboardObjectID=d.DashboardObjectID and dd.staffid=uStaffid where d.staffid=uStaffID and (d.DashboardObjectID=pDashboardObjectID or pAll=1 or pDashboard=dd.onDashboard or pHomePage=dd.onHomePage) union all select d.DashboardObjectID,s.name as UserName, d.Type, d.Title, d.Descriptor, d.Shared, null, dd.onDashboard, dd.onHomePage from DashboardObject d key join staff s, DashboardObject d left outer join DashboardDisplayedObject dd on dd.DashboardObjectID=d.DashboardObjectID and dd.staffid=uStaffid where d.staffid<>uStaffID and d.Shared=1 and uLevel>=isnull(d.AccessLevel,0) and (d.DashboardObjectID=pDashboardObjectID or pAll=1 or pDashboard=dd.onDashboard or pHomePage=dd.onHomePage) and isnull(s.divisionid,'') in (select DivisionID from DashboardStaffDivisions()) order by UserName, Title end }