Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Content Management (Extended ECM)
API, SDK, REST and Web Services
How to Create a LiveReport that shows levels for items and permission list for each item
Cheryl_Brock
I need to create a report that will return the items in a selected folder with the level and the list of users and their permission for each item.Here is my livereport sql:select level,d.dataid,d.parentid,ka.FIRSTNAME || ' ' || ka.LASTNAME || ' (' || ka.NAME || ')' "Owner", substr(Lpad('..',4*(level-1),'*')||d.name ,1,40) "Folder Name", DECODE(da.RIGHTID, -1,'Public Access', -2, 'Compass Administrators', k.FIRSTNAME || ' ' || k.LASTNAME || ' (' || k.NAME || ')' ) "UserGroup", da.PERMISSIONS "Rights" FROM DTREE d, KUAF k, DTREEACL da, KUAF ka WHERE da.DATAID = d.DATAID AND da.RIGHTID = k.ID(+) AND %2 AND d.DATAID IN (SELECT DATAID FROM DTREE START WITH DATAID = %1 CONNECT BY PRIOR DATAID = PARENTID) and da.RIGHTID != -2 and d.userid= ka.ID(+)The current output looks like this:LEVEL DATAID PARENTID Owner Folder Name UserGroup Rights 0 128456104 147499939 customview.html 258207 0 128456104 147499939 customview.html Team 258207 0 128456104 147499939 customview.html Public Access 36995 0 147499939 147505971 Admin Tools and Services Page - Old Admin 258207 0 147499939 147505971 Admin Tools and Services Page - Old Team 258207 0 147499939 147505971 Admin Tools and Services Page - Old Public Access 36995 0 147505971 145241757 Admin Other Customviews Admin 258207 0 147505971 145241757 Admin Other Customviews Team 258207 0 147505971 145241757 Admin Other Customviews Public Access 36995 What I want is the output to show the Level Column.Can someone assist me for this?
Find more posts tagged with
Comments
Lindsay_Davies
Message from Lindsay Davies via eLinkHi Cheryl,I think your first problem is that "level" will only contain informationwhen used with a connect by prior. In your statement, the connect by prior is in a sub select but level isused in the outer select.But, of course, if you remove the sub-select and put the connect byprior in to the main query, you get the error "cannot have join withCONNECT BY".The trick is to use an inline-view technique.First, let me format up your original SQL to make it more readable andeasier to compare with my suggestion...Your original statement isselect level, d.dataid, d.parentid, ka.FIRSTNAME || ' ' || ka.LASTNAME || ' (' || ka.NAME || ')' "Owner", substr(Lpad('..',4*(level-1),'*')||d.name ,1,40) "Folder Name", DECODE(da.RIGHTID, -1,'Public Access', -2, 'Compass Administrators', k.FIRSTNAME || ' ' || k.LASTNAME || ' (' || k.NAME|| ')' ) "UserGroup", da.PERMISSIONS "Rights" FROM DTREE d, KUAF k, DTREEACL da, KUAF ka WHERE da.DATAID = d.DATAID AND da.RIGHTID = k.ID(+) AND %2 AND d.DATAID IN (SELECT DATAID FROM DTREE START WITH DATAID = %1CONNECT BY PRIOR DATAID = PARENTID) and da.RIGHTID != -2 and d.userid= ka.ID(+)My suggestion is....select d.flevel, d.dataid, d.parentid, ka.FIRSTNAME || ' ' || ka.LASTNAME || ' (' || ka.NAME || ')' "Owner", substr(Lpad('..',2*(d.flevel-1),'*')||d.name ,1,40) "Folder Name", DECODE(da.RIGHTID, -1,'Public Access', -2, 'Compass Administrators', k.FIRSTNAME || ' ' || k.LASTNAME || ' (' || k.NAME|| ')' ) "UserGroup", da.PERMISSIONS "Rights"FROM KUAF k, DTREEACL da, KUAF ka, (SELECT level flevel, dataid, parentid, name, userid FROM DTREE STARTWITH DATAID = %1 CONNECT BY PRIOR DATAID = PARENTID) DWHERE da.DATAID = d.DATAID AND da.RIGHTID = k.ID(+) AND %2 and da.RIGHTID != -2 and d.userid= ka.ID(+)You can see that the select with connect by prior on DTree is nowreturning columns as though it was a new table D and I am selecting allthe columns you needed in the original list.This means we do not select from DTree in that outer list, but from D.We need to alias 'level' as a new column name 'flevel' for the inlineview D and refer to that in the manipulation in the main selectstatement.This should work for you - I tested it without the %1 and %2 and it wasOK.Good luck.RegardsLindsayUK SupportOpen Text -----Original Message-----From: eLink Discussion: Livelink LiveReports Discussion[mailto:livereportsdiscussion@elinkkc.opentext.com] Sent: 13 September 2006 21:02To: eLink RecipientSubject: How to Create a LiveReport that shows levels for items andpermission list for each itemHow to Create a LiveReport that shows levels for items and permissionlist for each item Posted by Brock, Cheryl L on 09/13/2006 04:00 PMI need to create a report that will return the items in a selectedfolder with the level and the list of users and their permission foreach item.Here is my livereport sql:select level,d.dataid,d.parentid,ka.FIRSTNAME || ' ' || ka.LASTNAME || '(' || ka.NAME || ')' "Owner", substr(Lpad('..',4*(level-1),'*')||d.name,1,40) "Folder Name", DECODE(da.RIGHTID, -1,'Public Access', -2,'Compass Administrators', k.FIRSTNAME || ' ' || k.LASTNAME || ' (' ||k.NAME || ')' ) "UserGroup", da.PERMISSIONS "Rights" FROM DTREE d, KUAFk, DTREEACL da, KUAF ka WHERE da.DATAID = d.DATAID AND da.RIGHTID =k.ID(+) AND %2 AND d.DATAID IN (SELECT DATAID FROM DTREE START WITHDATAID = %1 CONNECT BY PRIOR DATAID = PARENTID) and da.RIGHTID != -2 andd.userid= ka.ID(+)The current output looks like this:LEVEL DATAID PARENTID Owner Folder Name UserGroup Rights 0 128456104 147499939 customview.html 258207 0 128456104 147499939 customview.html Team258207 0 128456104 147499939 customview.html PublicAccess 36995 0 147499939 147505971 Admin Tools and Services Page - OldAdmin 258207 0 147499939 147505971 Admin Tools and Services Page - OldTeam 258207 0 147499939 147505971 Admin Tools and Services Page - OldPublic Access 36995 0 147505971 145241757 Admin Other Customviews Admin 258207 0 147505971 145241757 Admin Other Customviews Team 258207 0 147505971 145241757 Admin Other Customviews Public Access36995 What I want is the output to show the Level Column.Can someone assist me for this?[To reply to this thread, use your normal E-mail reply function.]============================================================Discussion: Livelink LiveReports Discussion
https://knowledge.opentext.com/knowledge/llisapi.dll/open/2249677Livelink
Server:
https://knowledge.opentext.com/knowledge/llisapi.dllTo
Unsubscribe from this Discussion, send an e-mail tounsubscribe.livereportsdiscussion@elinkkc.opentext.com.
Cheryl_Brock
I get the following error if a user does not have permission to veiw an item in the Folder structure:ORA-00904: "DTREE"."DATAID": invalid identifier - select d.flevel,d.dataid,d.parentid,ka.FIRSTNAME || 'Any ideas for this fix?
Lindsay_Davies
Message from Lindsay Davies via eLinkHi Cheryl,Sorry about that oversight.I guess the problem is the %2 needs moving into the inline view.Remove the "AND %2" from the current where clause.Add "WHERE %2" to the connect by prior line. (SELECT level flevel, dataid, parentid, name, userid FROM DTREE STARTWITH DATAID = %1 CONNECT BY PRIOR DATAID = PARENTID where %2) D This may not work of course.I have my fingers crossed.RegardsLindsay
Cheryl_Brock
Here is the output: I have looked everywhere for the missing parenthesis:Any other ideas?ORA-00907: missing right parenthesis - select d.flevel,d.dataid,d.parentid,ka.FIRSTNAME || ' ' || ka.LASTNAME || ' (' || ka.NAME || ')' "Owner", substr(Lpad('..',2*(d.flevel-1),'*')||d.name ,1,40) "Folder Name", DECODE(da.RIGHTID, -1,'Public Access', -2, 'Compass Administrators', k.FIRSTNAME || ' ' || k.LASTNAME || ' (' || k.NAME || ')' ) "UserGroup", DECODE(da.PERMISSIONS, '128','No Rights','130','S','36995','S/SC','62666','S/M','102531','S/SC/M','65670','S/M/AI','102547','S/SC/M/EP','233603','S/SC/M/EA','102535','S/SC/M/AI','118915','S/SC/M/DV','233619','S/SC/M/EP/EA','102551','S/SC/M/EP/AI','118931','S/SC/M/EP/DV','233607','S/SC/M/EA/AI','249987','S/SC/M/EA/DV','118919','S/SC/M/AI/DV','233623','S/SC/M/EP/EA/AI','250003','S/SC/M/EP/EA/DV','118935','S/SC/M/EP/AI/DV','249991','S/SC/M/EA/AI/DV','250007','S/SC/M/EP/EA/AI/DV','118923','S/SC/M/DV/D','127107','S/SC/M/DV/R','127115','S/SC/M/DV/D/R','118939','S/SC/M/EP/DV/D','127123','S/SC/M/EP/DV/R','127131','S/SC/M/EP/DV/D/R','249995','S/SC/M/EA/DV/D','258179','S/SC/M/EA/DV/R','258187','S/SC/M/EA/DV/D/R','118927','S/SC/M/AI/DV/D','127111','S/SC/M/AI/DV/R','127119','S/SC/M/AI/DV/D/R','250011','S/SC/M/EP/EA/DV/D','258195','S/SC/M/EP/EA/DV/R','258203','S/SC/M/EP/EA/DV/D/R','118943','S/SC/M/EP/AI/DV/D','127127','S/SC/M/EP/AI/DV/R','127135','S/SC/M/EP/AI/DV/D/R','249999','S/SC/M/EA/AI/DV/D','258183','S/SC/M/EA/AI/DV/R','258191','S/SC/M/EA/AI/DV/D/R','250015','S/SC/M/EP/EA/AI/DV/D','258199','S/SC/M/EP/EA/AI/DV/R','258207','Full Perm','16777215','Full Perm','102551','S/SC/M/EP/AI','241799','S/SC/M/AI/R','Unknown') "Rights", da.PERMISSIONS "RealNumber" FROM KUAF k, DTREEACL da, KUAF ka, (SELECT level flevel, dataid, parentid, name, userid FROM DTREE START WITH DATAID = :A1 CONNECT BY PRIOR DATAID = PARENTID where (exists (select DataID from DTreeACL b where b.DataID=NVL(DTree.PermID,DTree.DataID) and (RightID in (-1,135039186,135009533,163989572,134779261,164205278,134559208,138051355,138170100,138146557,138109563,138103470,134440927,134381459,164626263,164629114,134314536,134151920,134096444,164924215,164911918,164997406,133829650,133787098,130785296,165209260,133715530,133554125,133400722,165400459,165913796,132638404,166039415,166186623,166500853,166518251,132130859,166817540,130886721,131749410,149168765,149611574,141735196,141721841,141727011,141734945,141720854,141721186,139732364,138372154,143699527,167006590,131586350,131279173,131259351,131120757,149529690,149517169,140207659,150095653,150115890,148312085,150465716,150459993,147505470,150777976,151264933,151256049,146455003,151331052,146122671,151904255,151885366,145858754,145781369,152844851,152019891,152890729,152999437,153341825,153395351,139890829,138512014,153514150,136566772,153644667,144777378,144759194,144761645,144762578,144753639,144757903,144729717,144580390,144589916,144323167,154307396,144151647,144164121,144162223,144165496,144152963,144160156,144158198,144160864,144164764,144151483,144150902,144156951,144154495,144151999,144159164,142858610,144117335,144063549,144017376,143932914,143916974,154545568,143709115,154726982,143638815,154231942,154831257,143491786,143495714,143470852,155555213,155694356,155751372,143091852,142999010,142850147,142841256,142628435,142580825,156242068,156262555,156386281,142114669,142039896,156910604,157005423,157053538,141865233,141861004,141865190,141859002,141860447,141861450,141857944,141864912,141859445,141854624,157192772,135827649,135774645,135743562,163296255,135553007,135471814,163497284,135419918,135403086,135409855,135404209,135373098,141717117,141440858,135333291,135336259,135321168,163748756,163817724,135082302,141381170,164066468,164066467,153341827,130941252,1001,145865332,151355478,112824575,164205279,134779262,163989573,135039187,135082303,163817725,135321169,135336260,135333292,135373099,135404210,135409856,135403087,135419919,135471815,135553008,163296256,135743563,135774646,135835880,136016611,136022946,162823370,136456407,136537389,162529000,136812928,136883470,136905550,136921231,162073917,136987633,136980882,136970804,136985154,137048811,137169995,161836355,161822943,137250230,161795022,161718830,137312282,137312723,137307255,137305688,137314490,137312405,137302483,137316615,137311270,137304921,137305490,137301709,137305852,137314759,137315200,137322331,161727221,161683012,137539315,137556737,137564897,161151408,137747702,137810220,137938473,137954224,137958620,137998752) or RightID in (137997391,138010330,138014377,138011513,138013689,138038488,160663001,138277197,138301625,138377659,138420299,138418173,138431492,138439989,138432399,138456758,138463833,138464146,138460772,160341629,160068137,138588253,159812107,159786826,159738136,138730637,138741112,159663180,159546323,138870130,138871317,138914143,159401867,138957130,159345984,139043530,139114673,158716328,139564932,139606633,139608046,145127151,139750739,139993205,157942632,157941329,157935602,157832676,140396818,157640947,157628325,157534468,140469693,157458826,157458550,140862530,140898785,140951149,154231944,156910606,145865333,157170053,140951148,140898784,140862529,157458549,157458825,140469692,157534467,157628324,157640946,140396817,157832675,157935601,157941328,157942631,139993204,139750738,145127150,139608045,139606632,139564931,158716327,139114672,139043529,159345983,138957129,159401866,138914142,138871316,138870129,159546322,159663179,138741111,138730636,159738135,159786825,159812106,138588252,160068136,138516547,160341628,138460771,138464145,138463832,138456757,138432398,138439988,138431491,138418172,138420298,138377658,138301624,138277196,160663000,138038487,138013688,138011512,138014376,138010329,137997390,137998751,137958619,137954223,137938472,137810219,137747701,161138915,137961718,137564896,137556736,137539314,161683011,161727220,137322330,137315199,137314758,137305851,137301708,137305489,137304920,137311269,137316614,137302482,137312404,137314489,137305687,137307254,137312722,137312281,161718829,161795021,137250229,161822942,161836354,137169994,137048810,136985153,136970803,136980881,136987632,162073916,136921230,136905549,136883469,136812927,162528999,136537388,136456406,162823369,136022945,136016610,135835879,153467190,153485486,153642176,153721547,153814044,154130716,154528208,154546338,154587022,154667447,155064756,155185633,155155285,155493588,155500535,155603828,155914446,155905699,155919396,145941933,156353948,156616040,156642618,156667268,156710385,157168974,158466173,160055473,160058624,161694901,161748310,165066992,166122028,149618041,150223075,150225947,150230431,150221551,150865067,150955862,153357259,153568144,153933316,154707347,154789409,154878469,155023898,155644043,156797202,157830556,158197594,157604372,158316446,158975483,159338223,160832656,160880181,160887671,161011715,161058644,162232958,162219997,162531833,163026124,163260965,163494379,164225016,166278222,166998900,151256276,153325137,154079544,144777379,153644668,136566773,153514151,157415321,157773457,158593025,158623220,158716240) or RightID in (159012328,158999668,159136710,159108351,159417416,159840951,159893540,160122507,160342479,160665141,160764068,160887685,160876420,161036208,161223894,161462070,161644848,161869449,161867357,162338384,162608877,162603261,162602185,163491890,163524515,163580704,163617748,163637633,163646320,163813614,164166329,164189389,164273733,164531169,164619690,164738209,164795333,164901534,165060131,165280863,165459543,165555351,166001388,166002482,166261616,166433489,166432169,166536726,145234552,166849073,148532162,149442969,149701015,150082846,150944050,150964178,151003013,151340608,152869783,153110055,153107434,153188774,153316871,153610589,153604820,154073722,154103553,154532561,154725444,155114640,155424633,155534216,155920171,156247009,157157209,157217259,157631649,159400326,159425051,160875779,161021946,164344367,164369303,164367353,164356730,164364309,164366473,164364419,164358404,164359053,164357168,164360326,165028025,166264530,166265184,166403170,166426384,149700662,149691667,149864148,147332466,150828240,150835259,150936871,150986051,146510492,151015086,151364612,153006441,145253561,153502320,153591210,154855771,154949165,155340898,155673724,155906941,156064148,156244959,156499728,156685012,156687665,157200705,153395352,153341826,152999438,152890730,152019892,152844852,145796893,145858755,151885367,151904256,146122672,151331053,146455004,151256050,151264934,150777977,147505471,150459994,150465717,148312086,150115891,150095654,140207660,149517170,149529691,131120758,131259352,131279174,131586351,167006591,143699528,138372155,139743212,141721187,141720855,141734946,141727012,141721842,141735197,149611575,149168766,131749411,130886722,166817541,132130860,166518252,166500854,166186624,166039416,132638405,165913797,165400460,133400723,133554126,133715531,165209261,130785297,133787099,133829651,164911919,164924216,134096445,164629115,164626264,134381460,134440928,138103471,138109564,138146558,138170101,138051356,134559209,161699383,161478965,161135238,161091559,160929186,160923080,160689081,160573825,160569880,160553875,160555775,160571682,160582891,160376124,160369517,160372148,159844919,158698598,158503786,158398244,158388802,145066360,157885437,157877925,157537537,157333362,157036146,156889558,156709808,156385824,155762095,155617988,155489843,154796733,153871670,153399958,151706509,151891295,148231603,149935748,149920602,149141830,149197035,166227174,166162099,165501642,165504650,164703814,164613518,164548470,162969187,162873765,162845293,162705469,162654796,162452667,161064405,160879180,160798730) or RightID in (160585715,160564347,160558558,160467020,160389473,160369624,159883278,159604847,158742244,158631294,157852693,157412282,157345252,141440859,141717118,157192773,141854625,141859446,141864913,141857945,141861451,141860448,141859003,141865191,141861005,141865234,157053539,157005424,156910605,142039897,142114670,156386282,156262556,156242069,142580826,142628436,142841257,142850148,142999011,143091853,155751373,155694357,155555214,143470853,143495715,143491787,154831258,154231943,143638816,154726983,143709116,154545569,143916975,143932915,144017377,144063550,144117336,142858611,144159165,144152000,144154496,144156952,144150903,144151484,144164765,144160865,144158199,144160157,144152964,144165497,144162224,144164122,144151648,154307397,144323168,144589917,144580391,144729718,157345251,157412281,157852692,158631293,158742243,159604846,159883277,160369623,160389472,160467019,160558557,160564346,160585714,160798729,160879179,161064404,161802652,162452666,162654795,162705468,162845292,162873764,162969186,164548469,164613517,164703813,165504649,165501641,166162098,166227173,149197034,149141829,149920601,149935747,148231602,151891294,151706508,153399957,153871669,154796732,155489842,155617987,155762094,156385823,156709807,156889557,157036145,157333361,157537536,157877924,157885436,145066359,158388801,158398243,158503785,158698597,159844918,160372147,160369516,160376123,160582890,160571681,160555774,160553874,160569879,160573824,160689080,160923079,160929185,161091558,161135237,161478964,161699382,161812251,161846576,162028426,162045734,162219332,162285519,162423893,162420824,162588012,162644419,162744347,163293052,163354063,163452789,163529750,163768136,163775199,163828387,163920891,163960840,164338004,164617341,164623784,164847888,164900291,165061904,165114402,165139218,165257055,165446452,165550702,165698117,166118946,166163125,166114178,166160620,166185095,166327890,166435108,166505541,166606182,166734265,166728975,149670039,166972607,166974416,149668729,149224395,150082957,150290012,147806348,150459280,150494617,150899440,151001143,151074235,151134811,146684137,151292776,151294623,147005583,151340881,151358301,146295402,145883936,151900698,151892730,151702895,145873968,152827153,152948310,160764069,160665142,160342480,160122508,159893541,159840952,159417417,159108352,159136711,158999669,159012329,158716241,158623221,158593026,157773458,157415322,154079545,153325138,151256277,166998901,166278223,164225017,163494380,163260966,163026125,162531834,161058645,161011716,160887672,160880182,160832657,159338224) or RightID in (158975484,157604373,158197595,157830557,156797203,155644044,155023899,154878470,154789410,154707348,153933317,153568145,153357260,150955863,150865068,150221552,150230432,150225948,150223076,149618042,166122029,165066993,161694902,160058625,160055474,158466174,157168975,156710386,156667269,156642619,156616041,156353949,145941934,155919397,155905700,155914447,155603829,155500536,155493589,155155286,155185634,155064757,154667448,154587023,154546339,154528209,154130717,153814045,153721548,153642177,153485487,154552589,153467191,152948311,152827154,145873969,151702896,151892731,151900699,145883937,146295403,151358302,151340882,147005584,151294624,151292777,146684138,151134812,151074236,151001144,150899441,150494618,150459281,147806349,150290013,150082958,149224396,149668730,166974417,166972608,149670040,166728976,166734266,166606183,166505542,166435109,166327891,166185096,166160621,166114179,166163126,166118947,165698118,165550703,165446453,165257056,165139219,165114403,165061905,164900292,164847889,164623785,164617342,164338005,163960841,163920892,163828388,163775200,163768137,163529751,163452790,163354064,163293053,162744348,162644420,162588013,162420825,162423894,162285520,162219333,162045735,162028427,161846577,161812252,153966222,161700718,161087441,162917023,166114460,166081739,166089419,166084266,156075630,150563001,157200706,156687666,156685013,156499729,156244960,156064149,155906942,155673725,155340899,154949166,154855772,153591211,153502321,145253562,153006442,151364613,151015087,146510493,150986052,150936872,151427808,150835260,150828241,147332467,149864149,149691668,149700663,166426385,166403171,166265185,166264531,165028026,164360327,164357169,164359054,164358405,164364420,164366474,164364310,164356731,164367354,164369304,164344368,161021947,160875780,159425052,159400327,157631650,157217260,157157210,156247010,155920172,155424634,155114641,154725445,154532562,154103554,154073723,153604821,153610590,153316872,153188775,153107435,153110056,152869784,151340609,151003014,150964179,150944051,150082847,149701016,149442970,148532163,166849074,145234553,166536727,166432170,166433490,166261617,166002483,166001389,165555352,165459544,165280864,165060132,164901535,164795334,164738210,164619691,164531170,164273734,164189390,164166330,163813615,163641204,166087792,166117195,163637634,163617749,163580705,163524516,163491891,162602186,162603262,162608878,162338385,161867358,161869450,161644849,161462071,161223895,161036209,160876421,160887686)) and See>1))) d WHERE da.DATAID = d.DATAID AND da.RIGHTID = k.ID(+) and da.RIGHTID != -2 and d.userid= ka.ID(+)
Lindsay_Davies
Message from Lindsay Davies via eLinkHi,There seem to be 1264 rights in the expanded list.As far as I can tell the brackets match up. My guess is that the number of rights is causing a problem withinOracle.If the user who runs the report this time is an Admin user, then youwill not need to check permissions, as Admin users have full access, sothe check is superfluous.What happens when a regular user runs the report?I would expect a regular user not to have so many rights.Rights = membership of groups/projects.Lindsay
Cheryl_Brock
If Admin runs report, then no problem, if user runs report then I get the ORA error.Any suggestions on the SQL that might help?
Stefan_Becker_(stefanbecker_-_(deleted))
If you are using oracle 9 or above you can combine the joins and the connect by prior in the main query.So you don't have to use the permission filter in the subquery and the problem with the brackets shouldn't occur then.Performance could be a problem then, but you could give it a try.