DataSpreading function in TI

Post Reply
wang_chris
Posts: 122
Joined: Thu Jan 31, 2013 1:03 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2007

DataSpreading function in TI

Post by wang_chris »

I am going to write a process to repeat spread some initial number in TM1, but there is only CellPutProportionalSpread or CellIncrementN function descripted in TM1 reference manual.

Is there any function to do repeat spread in TI ?

Regards,
Chris
TrevorGoss
Community Contributor
Posts: 217
Joined: Thu Aug 15, 2013 9:05 am
OLAP Product: TM1
Version: 10.2.1.1
Excel Version: 14.0.6129.5000

Re: DataSpreading function in TI

Post by TrevorGoss »

Hello Chris,
Is there any function to do repeat spread in TI ?
There is no function that will perform this task in of its self, but you could also create a while loop and pass in arguments to the CellPutN function.

For example:

Code: Select all

x = 1; 
While(x < DIMSIZ('Dim1'));
      
           vEl = DIMNM('Dim1',vEl);
           CellPutN(999,'CubeName',vEl,'Dim2');

x = x + 1;
End;
That is a very basic way of putting 999 into every selected intersection of the cube. You can always write while loops inside other loops in order to pass multiple arguments into the CellPutN function. You could always use more than one CellPutN function call.

So, there is no one function to help you with this, but it is possible with other TI functions. You can always import a flat file into the cube aswell.

Let me know if I can explain in more detail.

Thanks.
BariAbdul
Regular Participant
Posts: 424
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: IBM TM1, Planning Analytics, P
Version: PAW 2.0.8
Excel Version: 2019

Re: DataSpreading function in TI

Post by BariAbdul »

Thanks a lot TrevorGoss ,Could you please expand bit on this part
You can always write while loops inside other loops in order to pass multiple arguments into the CellPutN function. You could always use more than one CellPutN function call
on above on the same scenario(Data Spreading function in TI)
"You Never Fail Until You Stop Trying......"
TrevorGoss
Community Contributor
Posts: 217
Joined: Thu Aug 15, 2013 9:05 am
OLAP Product: TM1
Version: 10.2.1.1
Excel Version: 14.0.6129.5000

Re: DataSpreading function in TI

Post by TrevorGoss »

Hello BariAbdul,

For example, if you wanted to place data around one Cube, you could use the TABDIM function. This function returns the dimension based off the cube and the order number of the dimension.

So...Cube1:Dim1:Dim2:Dim3....TABDIM('Cube1',1) = Dim1

To loop around the cube and return the dimension you could use:

Code: Select all

x = 1;
While(TABDIM('Cube1',x)@<>'')
    vDim = TABDIM('Cube1',x);
x = x + 1;
End;
You will then have a loop which will give you a dimension inside the selected cube for every time the while loop continues. you could then loop around that dimension and pass every element of it into the CellPutS function. You could do this for each dimension in the said cube.

For example:

Code: Select all

x = 1;
While(TABDIM('Cube1',x)@<>'')
    vDim = TABDIM('Cube1',x);

   vDimSizCount = DIMIX(vDim);
   y=1;
  While(y < vDimSizCount);
       vEl = DIMNM(vDim,y);
       CellPutS('Cube1',vEl,Dim2,Dim3);
x = x + 1;
End;
You could do this for each dimension in the cube.

The main purpose of this type of TI script is to work with the data that is given to you by controlling the flow of the program. You can grab returned values based off your looping around cubes and dimensions, to pass the needed metadata into the CellPutS Function.

It is always a good idea to use the "CellIsUpdateable" function when using the CellPut functions. For example If(CellIsUpdateable('Cube1',vEl,Dim2,Dim3)=1); (CellPutS('Cube1',vEl,Dim2,Dim3); EndIf;

This helps you avoid the attempt to put write to cells that cannot be written to, such as rule derived cells and C level.

Hope this helps.
BariAbdul
Regular Participant
Posts: 424
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: IBM TM1, Planning Analytics, P
Version: PAW 2.0.8
Excel Version: 2019

Re: DataSpreading function in TI

Post by BariAbdul »

Thanks a lot,Really helpful.
"You Never Fail Until You Stop Trying......"
wang_chris
Posts: 122
Joined: Thu Jan 31, 2013 1:03 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2007

Re: DataSpreading function in TI

Post by wang_chris »

Thank you, TrevorGoss.

Your suggestion is very helpful.
Post Reply