Ok, here’s the bits I modified. You CAN get duplicates where there’s more than one data provider, but this can be cancelled out by counting unique report name by object to get that analysis, or just count it to get a total usage count.
define another counter variable:
Dim i, j, k, l As Integer ' loop counters
put another column in the header output:
Print #OutNum, "Universe"; ", "; "Report Name"; ", "; "Class Name"; ", "; "Object Name"; ", Clause"
and here’s the central block of code with the loops around each part:
' This is dave's original loop code - this doesn't provide the class name to the object
' For k = 1 To dpMyDataProvider.Columns.Count
' Print #OutNum, strUniverseName; ", "; strCurrentFile; ", "; dpMyDataProvider.Columns.Item(k).Name; ", "; ", "; "Object"
' Next k
' This loop DOES return the class name
For l = 1 To dpMyDataProvider.Queries.Count
For k = 1 To dpMyDataProvider.Queries.Item(l).Results.Count
Print #OutNum, strUniverseName; ", "; strCurrentFile; ", "; dpMyDataProvider.Queries.Item(l).Results.Item(k).Class; ", "; dpMyDataProvider.Queries.Item(l).Results.Item(k).Object; ", "; "QObject"
Next k
Next l
' this is a loop to output formulae in the document. Disabled for normal use
' For k = 1 To docMyDocument.Variables.Count
' Print #OutNum, strUniverseName; ", "; strCurrentFile; ", "; docMyDocument.DocumentVariables.Item(k).Name; ", "; docMyDocument.DocumentVariables.Item(k).Formula; ", "; "Variable"
' Next k
' And to pick up objects used in conditions...
For l = 1 To dpMyDataProvider.Queries.Count
For k = 1 To dpMyDataProvider.Queries.Item(l).Conditions.Count
Print #OutNum, strUniverseName; ", "; strCurrentFile; ", "; dpMyDataProvider.Queries.Item(l).Conditions.Item(k).Class; ", "; dpMyDataProvider.Queries.Item(l).Conditions.Item(k).Object; ", "; "Condition"
Next k
Next l
sorry this is a little rough and ready, but I’m sure you get the gist. Hope this helps out!
Cheers,
philmorris (BOB member since 2002-11-12)