BusinessObjects Board

Changing Universe, including specifying the domain

This is in reference to this item found in BOB’s Downloads forum. It was written to allow a user to change a large number of documents from Universe A to Universe B. And I am sure it works very well when the names are different.

However…

I want to convert 400+ documents from an exported version of a universe to a local version of a universe. So the name is the same, but the domain is different. If I were doing this interactively I would select the universe where the domain name is . instead of an actual domain name like “Universe”. That would ensure that the document is pointing to a local version of the universe, and not an exported version.

But I can’t seem to find a way to change from one universe to another when the universe names are the same. :?

Any thoughts?


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

You could try adding these two lines to your code:

Application.ExchangeMode = boRepositoryMode
Application.ExchangeDomain = “Domain_Name”

Kate


Kate (BOB member since 2003-01-09)

Thanks, Kate, but I don’t think that’s quite what I am trying to do. I’m trying to open a document, and then run something like this:

        intDPCount = boDoc.DataProviders.Count
        For j = 1 To intDPCount
        
            Set boDP = boDoc.DataProviders.Item(j)
            boDP.Load

So far, that all works. That starts a loop for each data provider. Next, to obtain the current universe (and domain) from the dp use this:

           
            strFromUniverse = boDP.Universe
            strFromDomain = boDP.Universe.DomainName

To set the “transfer to” universe and domain, I tried this:

            strToUniverse = boDP.Universe
            strToDomain = "."

That doesn’t work. For one thing, the universe domain is read only. So what I really need is a way to specify the “.” universe. But since there are two copies of the same universe (with the same name and everything) that has proved to be an issue. But, once I identify the universe, I want to do this:

            
            boDP.ChangeUniverse (strToUniverse)
            boDP.Unload
            
        Next j

The ChangeUniverse() method switches the DP from one universe to another. The problem is that the domain is read only; I can’t change the domain of the universe, which makes sense. What I need to do, however, is change the document from (for example) Beach(Universe) to Beach(.).

Suppose you have a universe called XYZ, and that universe exists both locally (as a “Saved for all users” resource) and in the domain called “Production”. When you look at the list of universes, you’ll see XYZ with a domain of Production, and XYZ with a domain of “.”. The one with the dot is the non-exported version.

What I am working on now is getting a list of all universes, building an array that shows me which universe is exported and which isn’t, then using the index number (rather than the name) in the switch logic. I’ll post some code if I get it working.

The actual problem is this: I need to migrate hundreds of reports from one repository to another. So I have written VBA code to access the repository, and download each and every report. I then need to do a “Save for All Users” on the report. I also need to point them to a local version of the universe, so that when I log in to the second repository the document is pointing to a valid universe. That’s the part I am working on now.

Finally, I have written code to export each document to the new repository, and preserve the current category assignments. :crazy_face:

I may be working up a lather for nothing; BusObj lets me export the documents without assigning them to a new universe, but I need to make sure that the documents don’t “break” when someone imports / opens one of them from the new repository. I plan on reassigning the document from the “.” universe back to a version in the repository during the export process, so I’ll be doing the same process in reverse.

So that’s the issue. Not so much in a nutshell. 8)


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

Dave wrote:

I might not understand, but why can’t you do something like this (I am not sure, if you want to open the document or not, but you’ll get the idea):
Application.ExchangeMode = boRepositoryMode
Application.ExchangeDomain = “Universe”
Application.Document.Receive(“Beach.rep”)
Set boDoc = Application.Documents.Open(“Beach.rep”)

Application.ExchangeMode = boRepositoryMode
Application.ExchangeDomain = “.”
Application.Document.Receive(“Beach.rep”)
Set boDoc = Application.Documents.Open(“Beach.rep”)

Just a thought,
Kate


Kate (BOB member since 2003-01-09)

It’s not the document domain that’s the issue. It’s the domain for the universe used in the data provider. In the sample code you wrote, you use the Send and Receive methods. Those are used to publish / retrieve a document from a document domain.

What I want to do is take a document currently pointing to Universe A in the Universe domain, and point it to Universe A on my local harddrive, which has a domain name of “.” only. Make sense?


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

Sub ChngUnivr()
Dim dp As DataProvider
Dim unv As Universe

Set dp = ThisDocument.DataProviders.Item(1)
’ The “.” is for local UNV
Set unv = Application.Universes.Item(“Island Resorts Marketing”, “.”)
dp.ChangeUniverse unv
dp.Refresh
End Sub


Dan (BOB member since 2002-08-18)

I had done something like that, and it wasn’t working. But after seeing you post it I decided to try again. Ran it, still no luck. The document was still pointed to the original universe and domain.

Then, much to my chagrin :oops: :oops: :oops: I realized what my error was. It’s almost too much to tell… I was saving the document (using save for all users mode) and then changing the universe. Obviously if you want to change the universe, you should do that before saving the file. :? Anyway, works great now. Thanks for pointing me back in the correct direction. It may have been that it was working all along (I wasn’t getting any errors) and I had come up with about 3 different ways to try to work through this. But Edit THEN Save sure works better. 8)

Thanks, Dan, I owe you one.


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