----------------------------------------------Bhupinder Singh, B.Math, B.Ed.Senior Systems Analyst, Information TechnologyOpen Text, Waterloo, Ontario, Canada----------------------------------------------
The path procedure has to be added to the LLdatabase on sql server. If you have added it correctly, you should be able todo a simple query such as
SELECT Name,LLProdUser.hov_return_object_Path(DataID) AS Expr1
FROM LLProdUser.DTree
WHERE (DataID =671710)
and get name and the path (see screenshot):
Perhaps there is an issue with getting theprocedure added correctly. Hope this helps.
Bob
From: eLink Discussion: Open Text Live Reports Discussion[mailto:livereportsdiscussion@elinkkc.opentext.com] Sent: Thursday, September 17, 200911:25 AMTo: eLink RecipientSubject: Thanks Bob.
Thanks Bob.
Posted by atiya.sultana@accenture.com (Sultana, Atiya) on 2009/09/17 11:20
In reply to: RE Is it possible with SQL Server 2005?
Posted by bguilford (Guilford, Bob) on 2009/09/17 08:48
Thanks Bob. It's very helpful. But I get the error "Cannot find either column "lldb" or the user-defined function or aggregate "lldb.HOV_return_Object_Path", or the name is ambiguous" when I execute the sql with path. Can anyone help? Many Thanks, Atiya.
The procedure only needs to be added onceto the database, it should show in Mgmt Studio in the LL database. I suggestverifying the procedure is set for your environment (ie right user id..), etc.Originally, I worked on the procedure as sql code so I could tweak it moreeasily. You might try running it as a standalone query with a folder dataid inyour LL, such as:
WITH hierarchy(parentid, dataid, LEVEL, Name,Path) AS
(SELECTParentid, dataid, 0, name, cast(Name ASnvarchar(1024))
FROM llproduser.dtree
WHERE dataID = 1568215
UNION ALL
SELECT dt.parentid, dt.dataid, LEVEL + 1,dt.name, cast(dt.name AS nvarchar(1024))
FROM llproduser.dtree dt INNER JOIN
hierarchy h ON dt.dataid = h.parentid),
hierarchyReverse(parentid, dataid, LEVEL, Name,Path)
AS
(SELECT Parentid, dataid, 0,name, cast(Name ASnvarchar(1024))
FROM Hierarchy
WHERE parentid = - 1
SELECT h.parentid, h.dataid, hr.LEVEL+ 1, h.name, cast(hr.Path+ ':' +h.Path AS nvarchar(1024))
FROM Hierarchy h INNER JOIN
HierarchyReverse hr ONh.parentid = hr.dataid)
SELECT path
FROM HierarchyReverse
ORDER BY LEVEL
Then tweak ituntil the issues are resolved, then tweak the procedure with the same fixes.This gives me the result:
path
Recycle Bin:2009:09:16:0930 HP Fuel GasAmine Contactor Unit Specifications, Calibrations and Instrumentation Indexes 3
From: eLink Discussion: Open Text Live Reports Discussion[mailto:livereportsdiscussion@elinkkc.opentext.com] Sent: Thursday, September 17, 200912:28 PMTo: eLink RecipientSubject: The procedure got addedsuccessfully. This query also gives the same error.
The procedure got added successfully. This query also gives the same error.
Posted by atiya.sultana@accenture.com (Sultana, Atiya) on 2009/09/17 12:26
In reply to: RE Thanks Bob.
Posted by bguilford (Guilford, Bob) on 2009/09/17 12:12
The procedure got added successfully. This query also gives the same error. Do I have add the path procedure every time before i run the query? Thanks, Atiya.
-----Original Message-----From: eLink Discussion: Open Text Live Reports Discussion [mailto:livereportsdiscussion@elinkkc.opentext.com]Sent: Wednesday, September 23, 2009 4:16 PMTo: eLink RecipientSubject: Hi, Hi, Posted by atiya.sultana@accenture.com (Sultana, Atiya) on 2009/09/23 06:42 In reply to: Hi Bob, Posted by atiya.sultana@accenture.com (Sultana, Atiya) on 2009/09/18 05:13 Hi,Could anyone please help me know what am I doing wrong here to get the required results?Many Thanks,Atiya.
Hi Atiya,
I don’t know what’s going onfor you, they work in select statements on our sql 2005 server.
From: eLinkDiscussion: Open Text Live Reports Discussion[mailto:livereportsdiscussion@elinkkc.opentext.com] Sent: Thursday, October 01, 200912:01 PMTo: eLink RecipientSubject: It seems stored procedurecannot be used in a select statement.
It seems stored procedure cannot be used in a select statement.
Posted by atiya.sultana@accenture.com (Sultana, Atiya) on 2009/10/01 11:57
In reply to: Hi Bob,
Posted by atiya.sultana@accenture.com (Sultana, Atiya) on 2009/09/18 05:13
It seems stored procedure cannot be used in a select statement. Can anyone help me in sorting this out? Many Thanks, Atiya.
De : eLink Discussion: Open Text Live Reports Discussion [mailto:livereportsdiscussion@elinkkc.opentext.com] Envoyé : jeudi 22 octobre 2009 07:43À : eLink RecipientObjet : Final query Final query Posted by atiya.sultana@accenture.com (Sultana, Atiya) on 2009/10/22 07:40 In reply to: Got it Posted by atiya.sultana@accenture.com (Sultana, Atiya) on 2009/10/12 07:53 Hi,This is the final query to display documents and folders in a folder along with the path, level, documents size and their versions.WITH recursive_tempDTREE (level, parentid, dataid, name, Subtype, Pathstr ) AS ((SELECT 1, parentid, dataid, Name, Subtype as ObjectType, CAST ('' as VARCHAR(MAX)) FROM dtree (nolock) WHERE parentid = XXXXX) UNION ALL (SELECT level + 1, a.parentid, b.dataid, b.Name, b.subtype, Pathstr+ '\' + cast(a.name AS varchar(max)) as Location FROM recursive_tempDTREE as "a", dtree as "b" (nolock) WHERE b.parentid = a.dataid OR (b.parentid * -1) = a.dataid)) SELECT SPACE(level*10)+ c.Name as Name, c.dataid, dt.parentid, level, case c.subtype when 0 then 'Folder' when 144 then 'Document' Else 'Other Object' End As ObjectType, pathstr + '\' + cast(c.name AS varchar(max))as Location , dv.datasize/1024 as datasize_kB, dv.version, case la.ValStr when 'Status' Then 'Status' end as "Atos Cat Status", case la.ValStr When 'Version' Then 'Version' end as "Col2" FROM recursive_tempDTREE as "c", dtree as "dt" (nolock), dversdata as "! dv" (nolock) WHERE dt.dataid = c.dataid AND c.dataid = dv.docid AND dt.dataid = dv.docid UNION SELECT SPACE(level*10)+ c.Name as Name, c.dataid, dt.parentid, level, case c.subtype when 0 then 'Folder' when 144 then 'Document' Else 'Other Object' End As ObjectType,pathstr+ '\' + cast(c.name AS varchar(max)) as Location,0,0 FROM recursive_tempDTREE as "c", dtree as "dt" (nolock) WHERE dt.dataid = c.dataid AND (c.subtype = 144 OR c.subtype=0) GROUP BY c.level, c.parentid, c.dataid, dt.parentid, c.name, c.subtype,c.pathstr order by pathstr+'\'+CAST (c.name as VARCHAR(MAX)), c.dataidThanks Rouven for the reply to the post.Many Thanks,Atiya.