Page 1 of 1

Change in Element Name of a frequently used Dimension

Posted: Wed Dec 13, 2017 5:18 pm
by Pluto12
Hi folks,

I must say that i am completely new to TM1 and i am finding it extremely difficult to work on right now.

I am in need of Changing an Element name in dimension named 'Products'. The element - a 'ProductName' which is to be changed to "ProdContainerName", is used in many cubes. Unfortunately there is no way to do this in Dimension Editor.

I tried to find a way and came across SwapAliasWithPrincipalName but it seems that this causes problems. Could you please tell me if any of you have used this and your experience with this command? How to go about in using it?

I also came across "BedrockDimAttrSwapAlias". Has any of you fine folks have used it? In order to use it, i guess, i have to create an Alias for the particular element and then execute this process. Is this understanding correct ?

If i use this bedrock process, will it cause any break or cubes to display any wrong data.

Thanks so much,
Pluto12

Re: Change in Element Name of a frequently used Dimension

Posted: Wed Dec 13, 2017 6:29 pm
by declanr
I have never had a problem with swapping the alias in as long as you do it carefully.

You start with an element called “sprouts” and give it an alias called “turkey”... for TM1 to allow this in the first place you know that there can’t have been any other elements named either Sprouts or Turkey so that’s ok. When you swap them it will still be ok.
The risk is if you then delete the alias... if you had rules/TI/worksheet formulas looking at “sprouts” they would no longer work.
So either do it and change all possible references to Turkey before you delete the alias that now contains sprouts... or just never delete the alias. Make sure that only that element was changed with your alias and name it something obvious so people don’t delete it in the future.

Then you should be fine as TM1 rarely cares whether you use an elements name or alias in a function... the only exception being if you used the principal name function and then compared that to a string etc.

Re: Change in Element Name of a frequently used Dimension

Posted: Thu Dec 14, 2017 7:18 am
by Pluto12
Thanks so much Declan for replying!
declanr wrote: Wed Dec 13, 2017 6:29 pm I have never had a problem with swapping the alias in as long as you do it carefully.

You start with an element called “sprouts” and give it an alias called “turkey”... for TM1 to allow this in the first place you know that there can’t have been any other elements named either Sprouts or Turkey so that’s ok. When you swap them it will still be ok.
The risk is if you then delete the alias... if you had rules/TI/worksheet formulas looking at “sprouts” they would no longer work.
So either do it and change all possible references to Turkey before you delete the alias that now contains sprouts... or just never delete the alias. Make sure that only that element was changed with your alias and name it something obvious so people don’t delete it in the future.

Then you should be fine as TM1 rarely cares whether you use an elements name or alias in a function... the only exception being if you used the principal name function and then compared that to a string etc.
I got the above the steps and it is immensely helpful at this moment. The element which has to be renamed is used in multiple cubes , TI processes, Websheets and Rules.

Are you using the BedrockDimAttrSwapAlias or SwapAliasWithPrincipalName?

One question i had is after Swapping the Alias with the Initial name, suppose we do not delete the Alias(which will now contain the Initial Element Name). Will this impact the existing Cubes Data/Rules/TI processes/Worksheets in a negative way i.e will they break them ?
Or they will work as before even after the swapping and not deleting the Alias-initial Name ?

Thanks much

Re: Change in Element Name of a frequently used Dimension

Posted: Thu Dec 14, 2017 8:03 am
by Wim Gielis
Pluto12 wrote: Thu Dec 14, 2017 7:18 amOne question i had is after Swapping the Alias with the Initial name, suppose we do not delete the Alias(which will now contain the Initial Element Name). Will this impact the existing Cubes Data/Rules/TI processes/Worksheets in a negative way i.e will they break them ?
Or they will work as before even after the swapping and not deleting the Alias-initial Name ?
If don't want to change existing rules, processes, ... and they reference the old element name, then the (what is now the) alias should stay.
If you rework them or you don't reference the element, you can delete it.

Re: Change in Element Name of a frequently used Dimension

Posted: Thu Dec 14, 2017 10:47 am
by lotsaram
The main thing to note here is that there is a potential for data loss *if the alias used for the swap is deleted*

This is because TM1 won't recognize any change to cube data as a result of the dimension change (and really why should it). But within all the cube files in the file system the data is still held against the intersection with the old principal name. If the alias is deleted then on next server load the intersection will be undefined and associated data will be lost.

The only surefire way around this is to force a data change to all cubes containing the dimension and then perform a SaveDataAll. This will ensure that the disk copy of all cube data is associated with the new principal name. (Or don't remove the alias).

Re: Change in Element Name of a frequently used Dimension

Posted: Thu Dec 14, 2017 12:04 pm
by Pluto12
Thanks Wim and lotsaram!
lotsaram wrote: Thu Dec 14, 2017 10:47 am by lotsaram » Thu Dec 14, 2017 4:47 am

The main thing to note here is that there is a potential for data loss *if the alias used for the swap is deleted*

This is because TM1 won't recognize any change to cube data as a result of the dimension change (and really why should it). But within all the cube files in the file system the data is still held against the intersection with the old principal name. If the alias is deleted then on next server load the intersection will be undefined and associated data will be lost.

The only surefire way around this is to force a data change to all cubes containing the dimension and then perform a SaveDataAll. This will ensure that the disk copy of all cube data is associated with the new principal name. (Or don't remove the alias).

So , Please correct me if my understanding is wrong here - i have 2 options now :
Option1 : Put the new element name in the Alias of the dimension and do a Swap. Keep the swapped old name as it is. This will not hamper the exsiting TI Processes and CUbe Data. No need to change the Element name to new name in TI Processes. And No need for Server restart.

Option2: Put the new element name in the Alias of the dimension, do a swap, delete the Alias. Load all data into the Cubes again, Change the Rules and TI Processes,Websheets with the new Element Name. Finally , do a Server Restart.

Between the above two, Option1 is better.

I had another albeit a crazy idea, thinking of putting it out here. What if i stop the server and do a complete subdirectory search of the DATA folder and carry out a 'find and replace' of the dimension Element to its new element name?
And then restarting the server.

Re: Change in Element Name of a frequently used Dimension

Posted: Thu Dec 14, 2017 12:16 pm
by tomok
Pluto12 wrote: Thu Dec 14, 2017 12:04 pm I had another albeit a crazy idea, thinking of putting it out here. What if i stop the server and do a complete subdirectory search of the DATA folder and carry out a 'find and replace' of the dimension Element to its new element name?
And then restarting the server.
The files that you would need to be concerned with would the .dim file, any .cub file in which the cube uses that dimension, and any }elementattributes.dim and .cub file for the dimension. These aren't text files so you'll need a hex editor in order to find the references to the dimension element you want. I've never tried this before and I highly doubt it will work but give it a try. Just make sure you do it on backup copies of everything.

Re: Change in Element Name of a frequently used Dimension

Posted: Thu Dec 14, 2017 2:23 pm
by gtonkin
tomok wrote: Thu Dec 14, 2017 12:16 pm ... These aren't text files so you'll need a hex editor in order to find the references to the dimension element you want. I've never tried this before and I highly doubt it will work but give it a try. Just make sure you do it on backup copies of everything...
I have often used the Hex Editor method to rename objects, generally *not* for elements as the alias swap is simplest. This is useful for updating the Cub file after renaming the associated dimensions. You would obviously have to do the find and replace across all objects and folders when doing these object renames. The trick with the Hex editor method is knowing how to locate the length identifier of each object and updating it with the correct hex length after changing. One value to short or too long and you restore from back up. If any masochists out there feel it necessary to go this route, I can try and offer guidance and no guarantees.

In terms of the alias swap, prior to 10.2.2 FP4, I found that if I did not "dirty" cubes with associations to the dimension where I swapped the alias, then saved data, after a restart, I would lose data.

Re: Change in Element Name of a frequently used Dimension

Posted: Thu Dec 14, 2017 3:26 pm
by lotsaram
You don't need to reload all data. Or even reload any data. Just change one arbitrary cell value will do (and then change it back again if you like). All that's needed is to force the server to see a data change as this will force the cube to be saved to disk on next save data.

And yes find replace of all element references with a hex editor is not only crazy but impossible.

Re: Change in Element Name of a frequently used Dimension

Posted: Thu Dec 14, 2017 5:36 pm
by Pluto12
You are much kind folks here and i appreciate this help greatly!

@gtonkin Thanks for replying, i will request your help with Hex editor someday :) I do not even know how to use a hex editor to find the references to the dimension element i want. I surely get that it is a painful job but i would certainly like to get an idea of that.
Can Pspad be used for this purpose?
lotsaram wrote: Thu Dec 14, 2017 3:26 pm You don't need to reload all data. Or even reload any data. Just change one arbitrary cell value will do (and then change it back again if you like). All that's needed is to force the server to see a data change as this will force the cube to be saved to disk on next save data.
@lotsaram - Thanks again! Is this what gtonkin meant by "Dirty" cubes?
Could you please tell me if you are advising me to go for Option 2 as mentioned before or Option 1?

Re: Change in Element Name of a frequently used Dimension

Posted: Thu Dec 14, 2017 6:54 pm
by gtonkin
Pluto12 wrote: Thu Dec 14, 2017 5:36 pm ... I do not even know how to use a hex editor to find the references to the dimension element i want. I surely get that it is a painful job but i would certainly like to get an idea of that.
Can Pspad be used for this purpose?
You need a proper hex editor, not a text editor, I use Free Hex Editor Neo as it is free and allows overtyping and inserting which is what is required.

Re: Change in Element Name of a frequently used Dimension

Posted: Fri Dec 15, 2017 8:57 am
by Pluto12
Here is what i have done:
  • 1. Alias was added with the new Element in the dimension.
    2. Bedrock.Dim.Attr.SwapAlias was executed for the Dimension 'Products'. Checked the Data in the cubes and found that no data was lost.
    3. Due to Business need of completely eliminating the Old elemnt name, I renamed the swapped Alias(old name) to new name. So, currently both Element Name and its Alias contain the new name.
    4. Restarted the Server. However,please know, here i had not changed any value in the cubes( i think this is the concept of "Dirty cubes" which gtonkin was referring to, though i am unsure of that).
    5. Cubes were displaying data for the new element same as before although the old element name has been deleted. This is a bit Strange. Is this expected ?
    6. Changed the cube rules to rename old elemnt name to new name.
Have i done something wrong in the above steps, specifically the 4th step?

How did the data populate for the new element name when prior to this, only old element name was present ?

Re: Change in Element Name of a frequently used Dimension

Posted: Fri Dec 15, 2017 9:09 am
by gtonkin
Pluto12 wrote: Fri Dec 15, 2017 8:57 am ...
4. Restarted the Server. However,please know, here i had not changed any value in the cubes( i think this is the concept of "Dirty cubes" which gtonkin was referring to, though i am unsure of that).
...
Same as what Lotsaram was saying, you just need to change a cell in the cubes that use the dimension where you are swapping. A change flags the cube as "dirty"/changed and when you do a SaveDataAll, the cube is re-written to disk.
I would not remove the old alias until very sure that there are no dependencies any more - you risk breaking processes, templates, views with hard-coded elements etc. etc.

Re: Change in Element Name of a frequently used Dimension

Posted: Fri Dec 15, 2017 10:04 am
by John Hammond
Can confirm what the guys are saying on here.

I have a Dirty Cube Process somewhere which I can upload.

Forewarning for users of PM - you don't see the SwapAlias results unlike in good ol' Perspectives.

One thing where I think IBM missed a trick was the Caption which could have been used as the unaliased Element Name in user applications Café/Web thus making it very easy to change element names.

Re: Change in Element Name of a frequently used Dimension

Posted: Fri Dec 15, 2017 10:11 am
by Pluto12
John Hammond wrote: Fri Dec 15, 2017 10:04 am I have a Dirty Cube Process somewhere which I can upload.
Thanks John, that would be really helpful!