Hi,
I saw tool to report all the objects from a report, but I’m looking at a tool which would also list all the variables and their definition.
thanks,
Benoit
benoitd (BOB member since 2004-06-30)
Hi,
I saw tool to report all the objects from a report, but I’m looking at a tool which would also list all the variables and their definition.
thanks,
Benoit
benoitd (BOB member since 2004-06-30)
The same tool you reference could be adjusted to list all variables quite easily. The code currently goes through each data provider, but to add a loop that goes through each variable in the document would be very simple. You could output to the same file, maybe just add a column for whether the item was a query object or a document variable.
For a start, look at the DocumentVariables collection. Count how many there are, and loop through the list.
[Moving to SDK Forum to see if someone is interested in picking up the challenge. 8)]
Dave Rathbun (BOB member since 2002-06-06)
Good mornin’,
I use the below code to generate a list of the variables when something goes wrong while the report is running.
Hope it’s of use to you too!
Cheers,
Pete
Main Sub:
Sub ListVariables(Optional DocName As String)
Dim MyVar As Variant, MyVarC As Long, MyPublishFolder As String, LogFile As String, MySeparator As String, LogFileInt As Integer
LogFile = CleanFolderPath("\\os_server\Sts-Data\Business Objects\Log Files") & DocName & " Variables Log.txt"
LogFileInt = FreeFile
MyVarC = 0
MySeparator = Chr(9)
Open LogFile For Output As #LogFileInt
Print #LogFileInt, "Variable Log"
Print #LogFileInt, "------------"
Print #LogFileInt,
Print #LogFileInt, "1) Application Variables:"
For Each MyVar In Application.Variables
MyVarC = MyVarC + 1
Print #LogFileInt, MyVarC & MySeparator & Application.Variables.Item(MyVarC).Name & MySeparator & Application.Variables.Item(MyVarC).Value
Next MyVar
Print #LogFileInt,
Print #LogFileInt, "2) Document Variables:"
MyVarC = 0
For Each MyVar In Application.Documents(DocName).DocumentVariables
MyVarC = MyVarC + 1
Print #LogFileInt, MyVarC & MySeparator & Application.Documents(DocName).DocumentVariables.Item(MyVarC).Name & MySeparator & Application.Documents(DocName).DocumentVariables.Item(MyVarC).Formula
Next MyVar
Print #LogFileInt,
Print #LogFileInt, "3) Query Variables:"
MyVarC = 0
For Each MyVar In Application.Documents(DocName).Variables
MyVarC = MyVarC + 1
Print #LogFileInt, MyVarC & MySeparator & Application.Documents(DocName).Variables.Item(MyVarC).Name & MySeparator & Application.Documents(DocName).Variables.Item(MyVarC).Value
Next MyVar
Close #LogFileInt
End Sub
Functions:
Function CleanFolderPath(FolderPath As String) As String
On Error Resume Next
CleanFolderPath = Trim(FolderPath)
If Right(CleanFolderPath, 1) = "\" Then
Else
CleanFolderPath = CleanFolderPath & "\"
End If
MkDir (CleanFolderPath)
End Function
foshdafosh (BOB member since 2004-05-04)
thanks,
but I’m not familiar with VBA. How do I introduce this function in BO ?
thanks,
Benoit
benoitd (BOB member since 2004-06-30)