Page 1 of 1

How to Create Dimension from Cube view datasource

Posted: Tue Apr 05, 2011 2:41 pm
by lav4you
Hi all...

I have one cube which has two dimension namely Serial_No(item 1 to 1000) and second dimension Hierarchy with 6 items (Level 0, Attribute 0, Level 1, Attribute 1, Level 2, Attribute 2)

I want to use this view data to create dimension with 2 level of consolidation (zero as element + 2 consolidation level).. but don't know how to use this view in TI process please TM1 gurus... help me to solve this issue...

thanks in advance

regards,
Lav

Re: How to Create Dimension from Cube view datasource

Posted: Tue Apr 05, 2011 4:02 pm
by David Usherwood
Set your data source as a view of the cube including the elements you want from both dimensions.
Uncheck suppress zeros and suppress rules.
In your data tab (I believe), create the dimension element from your two dimensions coming in and add it to your destination dimension.
That should do it.

Re: How to Create Dimension from Cube view datasource

Posted: Tue Apr 05, 2011 4:45 pm
by lav4you
HI thanks for the reply...

but I want to use data within this view to generate dimensionnot sure how exactly this works?

Re: How to Create Dimension from Cube view datasource

Posted: Tue Apr 05, 2011 5:41 pm
by David Usherwood
The data will come from the view.
So, in the data tab, write the dimension.
Not sure how else I can explain it.

Re: How to Create Dimension from Cube view datasource

Posted: Tue Apr 05, 2011 8:36 pm
by Alan Kirk
lav4you wrote:HI thanks for the reply...

but I want to use data within this view to generate dimensionnot sure how exactly this works?
If I understand what you're doing correctly, and I'm not sure that I do:

1/ Create the view using the ViewCreate(Cube, ViewName); function.

I would do this in a separate process, though it's technically possible to do it in a single process. I'm assuming that you don't want to filter the view in any way; if you do you'll also need to create subsets. (The SubsetCreate(DimName, SubName); and ViewSubsetAssign(Cube, ViewName, DimName, SubName); functions.)

2/ Set that view as the data source for your main process. In the Variables tab of that process, set the Variable Types to String and the Contents to Other.

3/ If you really mean Create the dimension, use the DimensionCreate(DimName); function on the Prolog tab. If you really meant update it, skip that.

4/ In the Metadata tab (I must disagree with David on this one; if it's a dimension change use Metadata, not Data) use the DimensionElementInsert(DimName, InsertionPoint, ElName, ElType); function. This will run once for each of the records returned from your cube view. If the element already exists it will be ignored, if it doesn't it will be added.

5/ Also on the Metadata tab use the DimensionElementComponentAdd(DimName, ConsolidatedElName, ElName, ElWeight); function to add the N level elements to your consolidations.

Further information on all of these functions can be found in the Reference Guide.

Re: How to Create Dimension from Cube view datasource

Posted: Wed Apr 06, 2011 8:32 am
by jacktuckerman
I'd also add a ViewDestroy(cube,view) in your epilog or the next time you run your script it will abort due to the view you're trying to create already existing. Plus, that will trash the view and not leave any pesky views around for users to open. Especially if it's a server crashing monster.

That or wrap your ViewCreate statement up in an IF statement when you set it up to check if it already exists, then destroy it, and then build it, that keeps the view afterwards if that's what you want.

Plus, if you want to add attributes to the dimension, you must do that in the data tab.