is it possible to rename elements

Post Reply
telula
Posts: 99
Joined: Tue Nov 18, 2008 5:40 am

is it possible to rename elements

Post by telula »

Hello,
Is it possible to rename elements of a dimension without losing data?
I have a situation where project managers create contract names (an element in the Contract Dimension) and forecast using those contract names. However, some of them make typing mistakes or put the wrong contract name.

Thank you.
Alan Kirk
Site Admin
Posts: 6647
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: is it possible to rename elements

Post by Alan Kirk »

telula wrote:Hello,
Is it possible to rename elements of a dimension without losing data?
I have a situation where project managers create contract names (an element in the Contract Dimension) and forecast using those contract names. However, some of them make typing mistakes or put the wrong contract name.
You have only two choices:
(a) Create an alias called something like "Correct Name" which will initially be populated with the original name, but which you can then correct. The underlying element name may still be wrong, but if you generate reports using the new alias you'll have the correct name shown; or
(b) Export the data from the incorrectly named elements, delete those elements and create correctly named ones, then reimport the data.

You can't change names as such, only aliases. A change of the underlying element name deletes the original element, and creates a new one which therefore deletes all of the data associated with the original name.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
Marcus Scherer
Community Contributor
Posts: 126
Joined: Sun Jun 29, 2008 9:33 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2016
Location: Karlsruhe

Re: is it possible to rename elements

Post by Marcus Scherer »

If the elements already exist in the dimension you should present them in a dropdown list to your managers so that no incorrect input is possible.
Alan Kirk
Site Admin
Posts: 6647
Joined: Sun May 11, 2008 2:30 am
OLAP Product: TM1
Version: PA2.0.9.18 Classic NO PAW!
Excel Version: 2013 and Office 365
Location: Sydney, Australia
Contact:

Re: is it possible to rename elements

Post by Alan Kirk »

Alan Kirk wrote:
telula wrote:Hello,
Is it possible to rename elements of a dimension without losing data?
I have a situation where project managers create contract names (an element in the Contract Dimension) and forecast using those contract names. However, some of them make typing mistakes or put the wrong contract name.
You have only two choices:
(a) Create an alias called something like "Correct Name" which will initially be populated with the original name, but which you can then correct. The underlying element name may still be wrong, but if you generate reports using the new alias you'll have the correct name shown; or
(b) Export the data from the incorrectly named elements, delete those elements and create correctly named ones, then reimport the data.

You can't change names as such, only aliases. A change of the underlying element name deletes the original element, and creates a new one which therefore deletes all of the data associated with the original name.
I've been asked in a PM to clarify item (b) in the following circumstances:
"the end-users will Forecast for a new Employee and when the company actually hires the new employee then the element name should be changed to match the new employee name".

I'd emphasise that I'd use option (a) as strill the better one. In fact, rather than using names at all it's far better to use a base element name that doesn't need to be changed, isn't going to be used in reporting, and doesn't attempt to be descriptive; that's the job of aliases. Some kind of sequence like TM1EMP00001, TM1EMP00002, TM1EMP00003 etc, where the element names have no meaning outside of the cube, would work.

The employee's name could then be an alias, as could the payroll system's employee number and any other relevant information. That means that it's possible for any given element to start out as a forecast or budget one, and then be changed when the new employee's name and details are known. It also helps when existing employees change their name, as in my experience a number of newly married women still do.

However, the specific question was about the export process and that's simply this:
(a) The data in the elements which are to be renamed is exported into an ASCII text file. This can be done either by writing a TI, or by right clicking on the cube and selecting "Export as ASCIIData" then selecting the elements to be exported.
(b) The dimension can then be updated to change the name of the elements. (This may be done by XDI or the dimension editor or even TI; it doesn't matter.) Changing the element names (as opposed to just the aliases) will delete all of the data in those elements.
(c) Create a new TI process using the ASCII file which was created in step (a) as the data source. Each column of the ASCII file will be a variable, and one of those will be the employee name.

In the data tab of the TI process you would need to either do a lookup from a reference cube, or hard code in a block to "remap" the previous employee name to the new one. For example, suppose that the cube had 8 dimensions, and the employee dimension was the second of those. Three of the employees that you've budgeted for (originally named Budget0001 to Budget0003) have now been hired and you need to change the element names. The data relating to those three elements is in the source data file.

Code: Select all

If ( V2 @= 'Budget0001');
    s_NewEmployee = 'John Smith';
ElseIf ( V2 @= 'Budget0002');
    s_NewEmployee = 'Mary Jones';
ElseIf ( V2 @= 'Budget0003');
    s_NewEmployee = 'Oliver Cromwell';
Else;
    ItemReject ('Uh-oh, no remapping for element ' | V2 );
EndIf;

CellPutN ( V9, 'EmployeeCube', V1, s_NewEmployee, V3, V4, V5, V6, V7, V8 );
However maintaining such a system would be manually intensive and vulnerable to errors. Every time an employee name changed you'd need to either modify the lookup cube or update the TI code as the case may be.

Again, therefore, using "meaningless" base names with meaningful aliases is the better approach.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
Post Reply