DType Function in TM1: Syntax and Use

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 );
ELSE;
    CellPutS ( numbertostring(vValue), cCube, vYear, vMonth, pTargetVersion1 ,vProject , vAccount , vMeasure );
ENDIF;

 Here the DType function is assessing an element (vMeasure) in the Measures-Project dimension and if it is ‘N’ (for numeric), then we use CellIncrementN. If it is not numeric, then we use CellPutS.

This function can be used in both TM1 Rules and Turbo Integrator processes.

If you like this post, please spread the love…

About John

Managing Director of Infocube. We are a management accounting consultancy that specialises in Business Analytics.
This entry was posted in Rule Functions, TI Functions and tagged CellIncrementN, CellPutN, CellPutS, DType. Bookmark the permalink.