I ran the script found in List Objects Used in a set of Documents
but it only display the local name of a var. I would like to have the full path. In our universe, we have many fields who have the same name under different folder. So it is possible to always get the full path.
Note that with this report, if a 2 vars from 2 diff folder have the same name, then I get a partial full name, i.e. it will prefix the var with the folder name.
This will give you the class the object lives in, which will get you part of the way there…
SELECT
dbo.UNV_CLASS.CLS_NAME,
dbo.UNV_OBJECT.OBJ_NAME
FROM
dbo.UNV_CLASS,
dbo.UNV_OBJECT,
dbo.UNV_UNIVERSE
WHERE
( dbo.UNV_UNIVERSE.UNIVERSE_ID=dbo.UNV_CLASS.UNIVERSE_ID )
AND ( dbo.UNV_CLASS.UNIVERSE_ID=dbo.UNV_OBJECT.UNIVERSE_ID and dbo.UNV_CLASS.CLASS_ID=dbo.UNV_OBJECT.CLASS_ID )
AND (
dbo.UNV_UNIVERSE.UNI_LONGNAME = 'XXX'
)
If you have designer installed on the client, then this code will work for you.
Add the code here into a module making sure you add a reference to the designer library.
’
========================================================================================
' Modulename: mdlListObjectsInReport
' Author: Jon Stokes
' Create Date: 27/06/05
'
' Purpose: To produce all objects and conditions used in a report and the class/subclasses they belong to
'
' Paramaters to set:
' None - But designer library must be installed to run this add-in
'
' Revision History:
' 27/06/05 Creation date
'
' ========================================================================================
' All public variables declared here
Dim topclass As Boolean
Dim dsgnr As designer.Application
Dim unv As designer.Universe
Dim cls As designer.classes
Dim results As String
Sub ListObjects()
' Main sub to be called for the add in to work. References functions when required
' create instance of designer and login
Set dsgnr = CreateObject("Designer.Application")
dsgnr.Visible = False
dsgnr.LoginAs "USERNAME", "PASSWORD", False, "BOMain"
Set unv = dsgnr.Universes.Open("C:\Program Files\Business Objects\BusinessObjects 5.0\Universe\UNIVERSENAME") ' open the universe
Set cls = unv.classes ' reference all the classes in the universe
results = "" ' clear out the value from the previous run
' Reference the dataproviders, queries, results and conditions in the document
Dim DProv As DataProvider
Dim Qry As Query
Dim Res As Result
Dim Cond As Condition
Set DProv = ActiveDocument.DataProviders(1)
For Each Qry In DProv.Queries
For Each Res In Qry.results
Call fnCallClass(Res.Class, Res.Object) ' list the objects
Next Res
For Each Cond In Qry.Conditions
Call fnCallClass(Cond.Class, Cond.Object) ' list the conditions
Next Cond
Next Qry
' Bring up a form with the results listed in rows
debug.print results
' close all open objects and destroy active objects
unv.Close
dsgnr.Quit
Set dsgnr = Nothing
Set unv = Nothing
Set cls = Nothing
End Sub
Function fnGetClass(clsname)
' Purpose: To retrieve the class that the classname passed in belongs to
On Error GoTo Err:
Dim findcls As designer.Class ' class to search for
Dim rootcls As designer.Class ' the rootclass IE the parent class
' reference all classes in the universe
Set findcls = cls.FindClass(clsname) ' reference class to search for
Set rootcls = findcls.RootClass ' reference rootclass for searched class
' get parent class from function
fnGetClass = rootcls.name
Err: ' always come here regardless to destroy open objects
' Destroy these objects second time around onwards or will cause error
Set findcls = Nothing
Set rootcls = Nothing
If Err.Number = 91 Then ' then this class was top of the tree. Do not run function again
topclass = True
End If
End Function
Function fnCallClass(clsname, objname)
' Purpose: To call function that retrieves class by looping through a classname until reaching the
' top of the class tree for the that calssname.
Dim myclassname As String ' hold string for all the parent classes found
Dim searchclass As String ' the class to be searched for. The bottom class in the hierarchy
myclassname = "" ' set to blank at beginning
topclass = False ' assume not at top of tree on commencement
searchclass = clsname ' search for this classname
For i = 1 To 8 ' decide how many levels up you want to go. Will not error if too many
If topclass = False Then
myclassname = myclassname & "/" & searchclass ' to self plus searched class
searchclass = fnGetClass(searchclass) ' set search class for next time around
Else
myclassname = myclassname ' top class found. Just return already found
End If
Next i
results = results & objname & myclassname & vbCrLf ' print out the full hierarchy of classes. Lowest to highest
End Function
You just need to change the USERNAME, PASSWORD AND UNIVERSENAME.