BusinessObjects Board

Retrieve universes from repository through Designer SDK

Is it possible to obtain a list of all Universes in a specific Business Objects Repository solely through the Designer SDK? This topic provides a good way to loop through the Universe objects, but requires connecting via a DSN. Is there a way to use the Designer SDK and avoid the direct database access?

I have tried the following, but it didn’t seem to work. The count for AllUniverses is zero, but there are about 15 universes in the repository.


'Open Designer
Set DesignerApp = New Designer.Application
    
'Login to designer
Call DesignerApp.LoginAs(UserName, Password, False, RepositoryName)
DesignerApp.Interactive = False
DesignerApp.Visible = False
    
Set AllUniverses = DesignerApp.Application.Universes
    
Debug.Print AllUniverses.Count

If I try the same code, only using the BusinessObjects SDK I can get all of the universes.


'Open BusinessObjects
Set BusObjApp = New busobj.Application
  
'Login to BusinessObjects
Call BusObjApp.LoginAs(UserName, Password, False, RepositoryName)
BusObjApp.Interactive = False
BusObjApp.Visible = False
  
'Retrieve all of the Universes in BusinessObjects
Set AllUniverses = BusObjApp.Application.Universes

Debug.Print AllUniverses.Count

Thanks in advance.


RufusLancaster :us: (BOB member since 2005-11-02)

I think that you have a found a bug; The code returns zero all the time.

Funninly enough, if you open a universe and then do a count, the result is 1.


jonathanstokes (BOB member since 2004-09-17)

It’s not a bug. The Application.Universes class is only for those that are open. You need to use the Application.UniverseDomains class instead. The universe count is by domain. Something like this:

DesignerApp.UniverseDomains("yourDomainName").StoredUniverses.Count

Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

Using the Designer SDK, I can get the count and names of all of the universes currently in the repository (by accessing the StoredUniverses property). If we take this one step further, we should be able to loop through each of these universes, open them, modify something, and save them back to the repository. I have attempted just that in the following code.

'Open Designer
Set DesignerApp = New Designer.Application
    
'Login to Designer
Call DesignerApp.LoginAs(Username, Password, False, RepositoryName)
DesignerApp.Interactive = False
DesignerApp.Visible = False
        
'Retrieve all of the Universes in BusinessObjects
Set StoredUniverses = DesignerApp.UniverseDomains("Universe").StoredUniverses
            
'Loop through each Universe
For CurrentUniverse = 1 To StoredUniverses.Count
   
    Debug.Print "Attempting to open: " & StoredUniverses(CurrentUniverse).Name
    Set Universe = DesignerApp.Universes.Open(StoredUniverses(CurrentUniverse).Name)
    Debug.Print vbTab & Universe.FullName
    Universe.Close
        
Next CurrentUniverse

However, I am unable to open the universe by just using the Universe Name property. When using the Universes.Open method in the past, I used an absolute path (C:\Program Files\Business Objects\BusinessObjects Enterprise 6\Universes\test.unv), however in this case I would like to avoid importing the universe to my local machine. Is it possible to open a StoredUniverse without first importing it to my local machine? Also are there any alternative ways to modify an existing universe in a repository?

Thanks again.


RufusLancaster :us: (BOB member since 2005-11-02)

I’m afraid it does have to be imported for Designer to manipulate it. However, there are .Import and .Export methods to automate that process as well.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

Hi Dwayne, sorry, would like to continue such an old topic.
I am using 6.5.1, and yes, there’s .Import method to automate that process. However, .Import is a subroutine and not a function, so it doesn’t have any returned value. It means that we could not use .Import in the similar function as Open as in the Rufus’ code above (to get the FullName).
Is there any way around?

Thanks a bunch before hands.

Regards,
Nico.


nico.artanto (BOB member since 2005-06-03)

I have solved the problem, my code is similar to this:


    dirUniv = DesApp.GetInstallDirectory(dsUniverseDirectory) + "\" + "bomerger\"
    
    Do While ctr <= 1
        idUniv = DesApp.UniverseDomains("bomerger").StoredUniverses(ctr).Name
        'DesApp.Universes.Import "bomerger", idUniv
        Set Univ = DesApp.Universes.Open(dirUniv + idUniv)
        idUniv = Univ.LongName
        ctr = ctr + 1
    Loop

So here, I can connect between StoredUniverses class and Universes class… Thanks for your clues, Dwayne.

Regards,
Nico.


nico.artanto (BOB member since 2005-06-03)