DIMIX TM1 Function: Use, Syntax and Examples

DIMIX in TM1 checks if an element exists in a dimension either as a primary element ID or as an Alias. If the element or alias does exist in a dimension, it returns the index value of the element. If there is no element for the value being tested, it will return a 0.

Syntax of DIMIX

The DIMIX syntax is:

DIMIX (dimension, element);

Where:

  • Dimension – the name of the dimension you want to check
  • Element – the name of the element you are checking to see if it already exists

Use and Examples

The DIMIX function is quite often used with an IF statement to check if an element exists and if it doesn’t, to add to add the element into the relevant dimension. It is originally placed into the IF in the form:

IF ( DIMIX ('Year', sYear ) = 0);

This statement will check if the contents of the sYear variable exists in the Year dimension.  If variable sYear is not in the Year dimension, then the DIMIX will return 0.  This is then compared to “0” in the IF statement which resolves to a true answer.

Then, on the next line of your TI, you could add a DimensionElementInsert to add the element to your dimension and a DimensionElementComponentAdd to incorporate it into a hierarchy.

The whole TI section would then read:

DimName = 'Year';
IF ( DIMIX ( DimName , sYear ) = 0);
  DimensionElementInsert ( DimName , pInsertAfter, sYear , 'N' );
ENDIF;
DimensionElementComponentAdd ( DimName , pParent , sYear , pWeight);

This example checks if sYear is in the dimension called Year, then when it is not (the DIMIX is zero), it added the element into the Year dimension after whatever has been defined as pInsertAfter, as a numeric element. Finally, it adds the new element into a hierarchy with pParent as its parent using a weight of pWeight.

Usage in Rules and Processes

The DIMIX function can be used in Rules and Turbo Integrator processes. Remember, you can use it to assess both the regular element ID and an Alias.

The IBM post that explains DIMIX can be found here.

You might also like