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 ?
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.
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.
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 and bare :x it and add things manually for the time being
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.
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”
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