One of the team were just writing a TI to load a text file into TM1. It was all working swimmingly until he tried to load a string (a 3 character month (like “Jan”, in this case) and the CellIncrementN didn’t quite like trying to enter a string against a numeric (or simple) cell. The solution? Assess the type of the element we are targetting using the DType function. Getting the element type in this way is the same as getting the cell type.
Syntax of DType
The syntax is:
DTYPE(dimension, element); where
- dimension – is the dimension that you want to assess an element in to find it’s type
- element – the actual element you want to assess
It will return an ‘N’ for numeric, ‘S’ for string or ‘C’ for a consolidation (rollup) element.
Example of DType
Using the example described above, we have the following where we are trying to load data where the source has both text and numbers and we have both string and numeric measures.
IF ( DType ( 'Measures-Project' , vMeasure ) @= 'N' );
CellIncrementN ( vValue, cCube, vYear, vMonth, pTargetVersion1 ,vProject , vAccount , vMeasure );
CellPutS ( numbertostring(vValue), cCube, vYear, vMonth, pTargetVersion1 ,vProject , vAccount , vMeasure );
This function can be used in both TM1 Rules and Turbo Integrator processes.