cancel
Showing results for 
Search instead for 
Did you mean: 

How does one add tables to an existing universe using COM designer SDK.

Former Member
0 Kudos

Morning All

How does one add tables to an existing universe using COM designer SDK. I have tried:

objUniverse.Tables.Add (strTable_Name)

but get "Cannot create Table" error.

Any ideas?

Thanks in advance.

Anita

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Anita

Please refer to this [link|http://www.forumtopics.com/busobj/viewtopic.php?t=127257]

It may be useful.

Hope this helps!!

Regards

Sourashree

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Anita,

-Use the Add method to add classes and objects to an existing universe using a VB 6 application.

Adding a Class

Definition: Function Add(Name As String) As Class

Syntax: NameOfClassesVariable.Add

Adding an Object Instance

Definition: Function Add(Name As String, [ClassName As String]) As Object

Syntax: NameOfObjectsVariable.Add(name, [class])

- name is the name of the object.

- class is the name of the class containing the object. This parameter should be used in cases where more than one objects exist with the same name.

Sample Visual Basic 6 Code

Dim DesApp As Designer.Application

'MODIFY AND EXPORT CLASSES AND OBJECTS OF AN EXISTING UNIVERSE

Sub modify_and_export_universe()

Dim DesUnv As Designer.Universe

Dim DesCls As Designer.Class

Dim DesObj As Designer.Object

Dim DesDBCol As Designer.DBColumn

Dim DBColName As String

Set DesApp = New Designer.Application

'Login to designer

Call DesApp.LogonDialog

'Make sure to log on with your administrator profile

'e.g : "hostname","username", "password","Enterprise"

'Make Designer application visible

DesApp.Visible = True

'This line disable warning messages from Designer

DesApp.Interactive = False

'to Open locally the universe you want to modify

'Set DesUnv = DesApp.Universes.Open("club_uni")

'Use OpenFromEnterprise method (Universes Class) to import a universe from the repository and opens it

Set DesUnv = DesApp.Universes.OpenFromEnterprise("Universes", "club_uni", False)

'Add a valid connection which already exists

DesUnv.Connection = "club"

'open the universe

'Call DesApp.Universes.Open("club_universe")

'Add the table Account and refresh the view in the main window

Set DesTab = DesUnv.DBTables.Item("Customer").Insert

DesUnv.ArrangeTables

'Add a class

Set DesCls = DesUnv.Classes.Add("Class MyCustomer")

'Looping through all the fields of the DB Table Account

For Each DesDBCol In DesUnv.DBTables.Item("Customer").DBColumns

'Store name of the column

DBColName = DesDBCol.Name

'Add an object to the class

Set DesObj = DesCls.Objects.Add("Obj " & DBColName)

'Affect a field to the object

DesObj.Select = "Customer" & "." & DBColName

Next

'Save the existing universe with the same name club_uni or you can change

DesUnv.SaveAs "club_uni"

MsgBox "Universe created and saved Class MyCustomer has been added!!"

'Close the universe

UnvFullName = DesUnv.FullName

MsgBox "The UniverseFilePath is " & UnvFullName

'Close the universe

DesUnv.Close

'This line disable warning messages from Designer

DesApp.Interactive = False

'Export the universe to the CMS DB (to the last universe folder)

'Make sure you save the universe before exporting it

Call DesApp.Universes.Export("Universes", UnvFullName)

MsgBox "This document has been exported successfully !!"

'Close designer

DesApp.Quit

Set DesApp = Nothing

End Sub

Hope this helps.

Regards,

Deepti Bajpai

Former Member
0 Kudos

hi deepti

thanks for the reply.

I already have resolved it with the clue provided by sorashre.

Anita