cancel
Showing results for 
Search instead for 
Did you mean: 

DI API - Object Type from table name

Former Member
0 Kudos

Hi all,

I was wondering if there is a way to retrieve programatically the object type from the table name.

For instance I want to get the value oOrders (or 17) from the string ORDR.

This has to work in any cases.

Cheers,

Accepted Solutions (1)

Accepted Solutions (1)

AdKerremans
Active Contributor
0 Kudos

Hi Cyril,

Afaik there is no way to retrieve the objecttype from the tablename.

You have to write a function yourself to get the objecttype from the tablename.

Regards

Ad

Former Member
0 Kudos

Hi Add,

This is the best I could achieve, though this will only work if there is at least one record in the table...

    Public Shared Function GetObjectType(ByRef Obj_Recordset As Recordset, ByVal TableName As String) As BoObjectTypes
        Dim tRet As BoObjectTypes
        Dim sQuery As String = _
        "IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME = '" & TableName & "' AND COLUMN_NAME = 'ObjType') " & _
            "SELECT TOP 1 [ObjType] FROM [" & TableName & "]"
        Obj_Recordset.DoQuery(sQuery)
        If Obj_Recordset.RecordCount = 1 Then
            tRet = CType(Obj_Recordset.Fields.Item(0).Value, BoObjectTypes)
        End If
        Return tRet
    End Function

Cheers

Message was edited by: Cyril Morel

Answers (1)

Answers (1)

Gianluigi
Product and Topic Expert
Product and Topic Expert
0 Kudos

No, this is not available. If you need this you will need to implement it by yourself, getting the data by hand from the SDK DI documentation.

A word of caution: the relationship object type - table name can change during different releases.

Former Member
0 Kudos

Hi Gianluigi,

Thanks for your answer. Could be Request for Development, don't you think?

Cheers