How to determine cell relationship using the C-API (holding)

Post Reply
MartinBrandl
Posts: 11
Joined: Wed Nov 02, 2011 5:15 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: No

How to determine cell relationship using the C-API (holding)

Post by MartinBrandl »

Hi all,

to implement the holding functionality, I need to figure out whether a Hold is a leaf or a consolidation Hold (in dependence of the write location).
For example, we have 3 dimensions:

Dim_1
- Element_1_1
- Element_1_1_1
- Element_1_1_2
Dim_2
- Element_2_1
Dim_3
- Element_3_1

If Element_1_1_1, Element_2_1, Element_3_1 is set as a hold and Element_1_1, Element_2_1, Element_3_1 is set as the write location, it is a leaf hold.
If Element_1_1, Element_2_1, Element_3_1 is set as a hold and Element_1_1_1, Element_2_1, Element_3_1 is set as the write location, it is a consolidation hold.

Is there any function to determine that like cell a is a subset of cell b?

Any help would be appreciated.

Cheers,
Martin Brandl
bagovino
Posts: 26
Joined: Fri Oct 09, 2009 5:54 pm
OLAP Product: TM1
Version: 9.5.1
Excel Version: 2007

Re: How to determine cell relationship using the C-API (hold

Post by bagovino »

Not 100% sure if this is what you're asking for, but take a look at the TM1ElementType() property. You should be able to check to see if the TM1_INDEX the API returns for the elements you're looking at matches what's returned by TM1TypeElementConsolidated() to tell if the cell you're looking at is a consolidation or not.
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: How to determine cell relationship using the C-API (hold

Post by rmackenzie »

Hi, your question isn't too clear to me... so apologies if this is irrelevant information for you.

When you apply any hold within the cube, TM1 will make a cube in the background called }Hold_USERNAME_CUBENAME. This is a bit like a drill cube, in that it adds an extra dimension on the end of your original cube so it can store a string value to indicate, for any intersection either leaf-level or consolidated, whether or not a hold is applied.

Now, you can process this cube in TI, just like any other cube. If you take a basic flattened and zero-suppressed view of this cube then in the TI process you can work out, for every hold, whether it is at leaf-level or not using e.g. DTYPE for each element. Or perhaps you could use CellIsUpdateable; there are probably other methods.

I'm not sure if this actually addresses the question 'is there any function to determine that like cell a is a subset of cell b?'. To me, this sounds as though you want to know if some cell rolls up into another. In the TI example above, if you know in advance the elements of the consolidated cell then you can use some combination of the ELISANC, ELPAR, ELISCOMP group of functions to determine if a cell (maybe the current one you are processing) has a relationship with another cell.

Doing all this via the API is possible, but probably much more difficult than using more out-of-the-box functionality in TI. Either way you will need to roll your sleeves up for a bit of coding. Possibly, you are trying to do something quite simple in a very difficult way? If so, good luck anyway!
Robin Mackenzie
MartinBrandl
Posts: 11
Joined: Wed Nov 02, 2011 5:15 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: No

Re: How to determine cell relationship using the C-API (hold

Post by MartinBrandl »

Thanks for your posts and sorry for the late reply I've been busy.

I'm completely bound to the C-API and can't use the TI for this.

If I splash a value to cell "C1" and I have placed a hold to cell "C2", I need to figure out whether I need to set the hold using "H" or "HC" (in TM1CubeCellSpread).
My GUI doesn't distinguish between consolidation or leaf hold - there is only a hold button.

I want to implement a function "IsConsolidationHold" which takes two cells: the hold cell and the write cell. This function should decide which type of hold I need to set.

How can I achieve that?

Cheers,
Martin Brandl
bagovino
Posts: 26
Joined: Fri Oct 09, 2009 5:54 pm
OLAP Product: TM1
Version: 9.5.1
Excel Version: 2007

Re: How to determine cell relationship using the C-API (hold

Post by bagovino »

I looked through the API documentation and I think I found what you're looking for.

Look up the TM1CubeCellSpreadStatusGet function. According to the documentation it will return an array where each index will have 1 of the following 3 values:

TM1CubeCellSpreadStatusHeld()
TM1CubeCellSpreadStatusHeldConsolidation()
TM1CubeCellSpreadStatusWritable()
MartinBrandl
Posts: 11
Joined: Wed Nov 02, 2011 5:15 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: No

Re: How to determine cell relationship using the C-API (hold

Post by MartinBrandl »

Hello bagovino,

thanks for your help.

I tryed to use TM1CubeCellSpreadStatusGet - without success. I think the function is to determine whether a (already set) hold is consolidation or leaf?

Cheers,
Martin
Post Reply