BusinessObjects Board

Extract Object Names, Object Definitions used in current rep

I was wondering if the Object model allows a macro to be written to grab the object names and definitions used on the current report and export them to a flat file.

Can someone point me in the right direction please?
Thanks.
Hao.


browncow (BOB member since 2002-09-05)

Yes I believe it does and this should give you a major head start.


Cindy Clayton :us: (BOB member since 2002-06-11)

As would this :bob:

I like mine better, as it does a bit more. It can easily be tweaked to include formulas, variables, and other document items as well.

Dave


Dave Rathbun :us: (BOB member since 2002-06-06)

Perhaps I sould start a new thread but …

Is there any way in VBA to determine whether a report variable or formuls is Character, numeric, od date ?? I’ve been digging most of the day without success.


Bill Frillman (BOB member since 2002-07-12)

I can tell you if it is a dimension, detail, or measure (variable.Qualification), whether it is a variable or formula (does variable.Name have a value), whether it comes from a data provider or is a report (local) variable (variable.IsDataProviderObject), but strangely enough, there is no option to determine the datatype.

You could check one of the values using the various Is{SomeType} functions. I don’t know how reliable it would be. Here’s some sample code I tossed together to test this. Note at the end the data type is inferred from the first value from each variable…

Sub ListVariables()

    Dim boDocument As busobj.Document
    Dim boDocVar As busobj.DocumentVariable
    
    Dim i, intVariableCount As Integer
    
    Dim strItemType, strItemName, strDataType As String

    Set boDocument = ActiveDocument
    intVariableCount = boDocument.DocumentVariables.Count
    
    For i = 1 To intVariableCount
    
        Set boDocVar = boDocument.DocumentVariables.Item(i)
        If boDocVar.Name = "" Then
            strItemType = "Formula"
        Else
            strItemType = "Variable"
        End If
        
        strItemName = boDocVar.Name
               
        variantTmpValue = boDocVar.Values(boUniqueValues)
        If IsNumeric(variantTmpValue(1)) Then
            strDataType = " is numeric"
        Else
            If IsDate(variantTmpValue(1)) Then
                strDataType = " is date"
            Else
                strDataType = " is character"
            End If
        End If
        
        If strItemType <> "Formula" Then
            MsgBox "Item " &amp; strItemName &amp; strDataType
        End If
    
    Next i

End Sub

Good luck! Post back if you get a better solution.

Dave


Dave Rathbun :us: (BOB member since 2002-06-06)

Dave,

Awesome.
Unfortunately I’ve got the classic problem of numeric values in character fields with the usual requirement of keeping leading zeros. And those are seen as “numeric”.
I know that the DP variables do have a Type so perhaps this is another flaw in the model.
I’ll keep my toes crossed and hope someone else has found a solution.


Bill Frillman (BOB member since 2002-07-12)

So you ran this code sample and it reported that variable as “numeric” as a datatype? Bummer.


Dave Rathbun :us: (BOB member since 2002-06-06)

YEP :reallymad: But I’m still exploring :hb:


Bill Frillman (BOB member since 2002-07-12)

dave could u please tell what is variantTmpValue declared as

can u please tell whether the code u have posted lists the datatype of report variables and how to find whether its a date,character,Numeric datatype,if possible please paste the code once again


deepakal (BOB member since 2005-05-02)