BusinessObjects Board

Adding joins to contexts via updates to repository

Hi, :slight_smile:

I’ve got a universe that has alot of contexts, I need to add to most of these contexts a new join. Rather than doing it manually in Designer has anyone managed to achieve the same thing by updating the repository directly ?

Cheers
Rich :slight_smile:


Rich :uk: (BOB member since 2002-10-04)

I wouldn’t recommend adding directly to the repository. Someone can correct me if I’m wrong, but I believe you need to let the system assign an object key so that it can refresh between all tables. Even if the system did allow you update and you missed just one reference point you could break a lot of reports when another context is added later.

For what my 2 cents is worth.

Have a great day!


MayhewM :us: (BOB member since 2003-10-22)

I can only agree with Michael. I know this can be a pain but its the safe way to do it. What sort of numbers are you talking anyway?


Nick Daniels :uk: (BOB member since 2002-08-15)

The universe has got 93 contexts at present :blue: :oops: (think record for context per universe on this forum is 300 plus or something)

I know its not idea but it works and at the moment I dont have time to re-build the whole universe which would be the best solution.


Rich :uk: (BOB member since 2002-10-04)

I will chime in and agree that direct repository update would be a bad idea. However, if you are comfortable with the SDK, it can be automated that way. I had one occasion where I added a new dimension table, then because of volume (and the increased chance for error), I automated the adding of the joins themselves as well as adding the joins to contexts.

The benefit of course is that by using the Designer SDK, it can be both automated and supported. If this is an option for you, I can try to dig up that code.


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

Hi Hoffpauir

Looks like a novel way of getting things done, would you mind sharing the source code

thanks


gowthaman (BOB member since 2002-08-15)

Cheers for the advice unfortantly we don’t have the SDK licience. Oh well.
its a one off with this universe anyway and when I get more time its going to be rewritten. So I’m going grin :slight_smile: and bare :x it and add things manually for the time being :sleeping: :sleeping: :sleeping:


Rich :uk: (BOB member since 2002-10-04)

OK, I found what I had written and simplified it trememdously. It is an Excel-based utility and can be found here. I hope someone finds it useful (Rich, let your conscience be your guide), and if you have any problems or other feedback, post it here.


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

Hi
I found this script interesting for to dublicate large contexts.
Why do I need to dublicate ?
For example, there is context with a lot of dimensions and facts F1 - granted amount.
But then I need LAST granted amount in period.
Therefore I need to create alias F2 for F1 with self join (subquery filters last in period).

My plan was to GetLists from universe, rename all F1 contexts joins to F2 and then AddJoinToContext all joins to new F2 context.

But, Joins&Contexts throws me “-2147417851 (80010105)
Automation error
The server threw an exception”

No idea where’s problem :frowning:

BO 5.1.6, MS excell 2000

thanks


miganos :latvia: (BOB member since 2004-02-06)

oops…posted in old topic…


peternolan9 (BOB member since 2003-02-01)

The following functions can be used to add contexts into the universe.
Context names has to be loaded in Sheet “Contexts” in the column 3


Sub AddContexts()

    Dim DesignerApp As Designer.Application
    Dim Univ As Designer.Universe
    Dim Jn As Designer.Join
    Dim Cont As Designer.Context
    Dim Rng As Excel.Range
    Dim RowNum As Long

    Set DesignerApp = New Designer.Application
    DesignerApp.Visible = True
    Call DesignerApp.LoginAs

    Set Rng = Sheets("Contexts").Cells
    RowNum = 2

    Set Univ = DesignerApp.Universes.Open
    Do Until Rng(RowNum, 3) = ""
        Call Univ.Contexts.Add(Rng(RowNum, 3))
        RowNum = RowNum + 1
    Loop

End Sub

smartpandian (BOB member since 2009-01-27)

That code looks very familiar … Add joins to universe / joins to contexts using Designer SDK


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

Dwayne, do you have an updated version that works with XIr2?

When I try to run the macro, I get an error. When I go into VBA in Excel and call up the References panel, it says:

“Missing: BO designer 5.1 object library”.

So I tried un-checking this library and using the Designer 11.5 library, but then there’s an error “The LoginAs method has been deprecated.”


dnewton :us: (BOB member since 2004-01-30)

@dnewton:

Can you use LogonDialog instead of LoginAs… ?
That is the only method that always create issues … in XI.


BO_Chief :us: (BOB member since 2004-06-06)

BO_Chief’s guidance is correct. Use .LogonDialog instead of .LoginAs.


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