SwapAliasWithPrincipalName TI Function – How to Use and Syntax

Have you ever needed to swap the contents of an alias with the primary element name in a TM1 dimension? Well, there is a function that will do exactly this called SwapAliasWithPrincipalName. It does just what it says it will – swap the element’s principal name with the specified alias.

There has never been a mechanism before within TM1 for renaming elements that’s why this is such a big feature. Previously, copying data from one element to another has to be done manually. It is so important to correctly name elements based on codes and identifiers where possible instead of descriptive and often updated names.

For example, Account codes are much preferred to Account Names. This function can fix it for you if, for whatever reason, they were set up using names. For more information on this check out our post titled 3 Cardinal Rules of Sustainable TM1 Development.

I’ve just given it a go, to fix up a small dimension which was using descriptive names as elements. Here are some tips adding to what has been posted here on BiHints.com.


Syntax

The syntax is:

SwapAliasWithPrincipalName(Dimension,Alias,Switch);

Where:

  • Dimension is the name fo the dimension to perform the swap,
  • Alias is the name of the alias you will swap with the element IDs
  • Switch – This is a numeric variable that must equal 0 for the process to run. So when you’re setting up the TI, set the flag to any value other than 0 to test, then when you’re ready to go, change it to zero.

Method for using SwapAliasWithPrincipalName

  1. First, the alias you are going to use for the swap isn’t used for anything else at the consolidation level.
  2. After that, check for any TI Processes you need to update. Then look at the code after the swap has been executed.
  3. Backup the Server before execution.
  4. Execute your TI to perform the swap.
  5. Lastly, restart the Server after you have run the function. After we tested out the function, TI Processes which referenced consolidation elements were producing an “Element not found” error within the TI Process error log. A TM1 Service restart fixed this.

Hope this helps any others working on a similar situation.

  • This field is for validation purposes and should be left unchanged.

Leave a Reply

Your email address will not be published. Required fields are marked *

Log In