Page 1 of 1

DataSpreading function in TI

Posted: Thu Feb 05, 2015 9:21 am
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

Re: DataSpreading function in TI

Posted: Thu Feb 05, 2015 4:11 pm
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.

Re: DataSpreading function in TI

Posted: Thu Feb 05, 2015 5:25 pm
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)

Re: DataSpreading function in TI

Posted: Fri Feb 06, 2015 9:11 am
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.

Re: DataSpreading function in TI

Posted: Fri Feb 06, 2015 9:30 am
by BariAbdul
Thanks a lot,Really helpful.

Re: DataSpreading function in TI

Posted: Sun Feb 08, 2015 3:05 pm
by wang_chris
Thank you, TrevorGoss.

Your suggestion is very helpful.