To download the CSP files from this tutorial, click TutorialSamples_vb.zip. For more information about using the samples, see Code examples.
<META HTTP
<!-- #Include file=RetrieveIStore.csp -->
Function RetrieveFullPath(FolderID, IStore, Success)
'This function returns an HTML string that provides links
'to all of the parent folders for the current folder.
'The root folder is called 'Home'.
'FolderID - The ID of the folder currently being viewed.
'IStore - The InfoStore object required to interface with server.
'Success - True if no error, False otherwise.
'Error - Contains the error: 0 if successful.
'The function returns an HTML string.
'This is the root folder. It has no name, so we will call it 'Home'.
RetrieveFullPath = "<a href='home.csp
'A query that selects the parent folder's ID.
Query = "Select SI_PATH, SI_NAME From CI_INFOOBJECTS Where " & _
Set Result = IStore.Query(Query)
'There was an error querying the server.
'Just in case something went wrong, check to see that you have a folder.
'The number of parent folders.
NumFolders = Result.Item(1).Properties("SI_PATH").Properties("SI_NUM_FOLDERS")
'The HomeLink variable is used to to prefix the complete path with a link to the root folder.
HomeLink = "<A HRef='home.csp
'The full path must at least include the folder we are in.
CurrentName = Server.HTMLEncode(Result.Item(1).Title)
'This variable represents the current folder.
CurrentFolder = "<A HRef='home.csp
FullPath = HomeLink & " / " & CurrentFolder
'This loops retrieves all the current folder's parent folders and concatenates them into
'a complete path of hyperlinks to each of the folders.
ParentId = Result.Item(1).Properties("SI_PATH").Properties("SI_FOLDER_ID" & CStr(k))
ParentName = Result.Item(1).Properties("SI_PATH").Properties("SI_FOLDER_NAME" & CStr(k))
ParentName = Server.HTMLEncode(ParentName)
FullPath = "<A HRef='home.csp
ParentName & "</A>" & " / " & FullPath
'Now that you have a complete path of the parent folders to the current folder,
'create the full path prefixed with the home link and suffixed with the current folder link.
FullPath = HomeLink & " / " & FullPath & CurrentFolder
'Retrieve the CurrentFolderID from the file's parameter list.
CurrentFolderID = Request.QueryString("FolderID")
Response.Write "<TABLE Width='100%'><TR>"
'Try and retrieve the InfoStore object.
If RetrieveIStore(IStore)=FALSE then
'If it failed redirect the user to the logon page.
Response.Redirect "LogonForm.csp"
FolderPath= RetrieveFullPath(CurrentFolderID, IStore,Success)
Response.Write "<TD>" & FolderPath & "</TD>"
Response.Write "There was an error trying to retrieve the full path of the folder."
'Write the link to the search page.
Response.Write "<TD Align='right'><A HRef='searchform.csp' Target='Main'>Search</A></TD></TR>"
'Write the link to the log off page.
Response.Write "<TR><TD></TD><TD Align='right'><A href='Logoff.csp' Target='_top'>Logoff</A></TD></TR></TABLE>"
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |