Client Management Suite

 View Only

How can the folder path of a console object be retrieved in NS 7? 

Oct 01, 2009 11:49 AM

In NS6 there was a function called "GetItemPath" in which return the path for an object in the Console. How can I get the folder path in NS 7?

"GetItemPath" function does not exist in the NS 7 database. Here is the sql behind creating that function for changes in the NS 7 database:

 

USE [Symantec_CMDB]

GO

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

ALTER FUNCTION [dbo].[GetItemPath]

(

      @Guid Varchar(40)

)

Returns varchar(8000)



AS



Begin



DECLARE    

  @SearchGuid VARCHAR(40),    

  @ItemPath VARCHAR(500),    

  @ExitCounter INT    

    

SET @SearchGuid = @Guid

SET @ItemPath = ''    

SET @ExitCounter = 0    

    

WHILE @ExitCounter = 0    

BEGIN    

  IF EXISTS (SELECT * FROM ItemFolder WHERE ItemGuid = @SearchGuid AND ParentFolderGuid != 'D0E33520-C160-11D2-8612-00104B74A9DF')    

  BEGIN    

    SET @ItemPath = (SELECT TOP 1 [Name] + '/' FROM Item WHERE [Name] NOT LIKE '/_%' escape '/' and Guid =     

                      (SELECT TOP 1 ParentFolderGuid FROM ItemFolder WHERE ItemGuid = @SearchGuid)    

                    ) + @ItemPath    

    SET @SearchGuid = (SELECT TOP 1 ParentFolderGuid FROM ItemFolder WHERE ItemGuid = @SearchGuid)    

  END    

  ELSE    

  BEGIN    

    SET @ExitCounter = 1    

  END    

END    



RETURN @ItemPath



END

 

Usage of this function:

SELECT [Symantec_CMDB].[dbo].[GetItemPath] ('GUID')

 

Where GUID is the guid of your object.

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Related Entries and Links

No Related Resource entered.