Page 1 of 1

TM1 Duplicate Element Delete Process

Posted: Fri Oct 15, 2010 7:40 pm
by mastertito4
I have searched through the forums and was able to find any help regarding a possible process that would delete duplicate elements within the same roll-up/hierarchy.

I have a products dimensions with 9 different roll-ups, and one (and most likely many others) of my elements actually appears 11 times. I have confirmed that it is showing up in the same roll-up twice, same element with the same attributes, data, etc. Since I am dealing with around 5000 unique elements in this dimension I was hoping there would possibly be a process that can be written to delete the extra elements?

Example of the error:

Σ-Material Type
Σ-Market Segment
_____Σ-MKT_A
________n-PARTNUMBER_12345
________n-PARTNUMNER_12346
_______n-PARTNUMBER_12347
_____Σ-MKT_B
________n-PARTNUMBER_12340
________n-PARTNUMBER_12345
Σ-End Customer Group

So Market Segment is one of multiple roll-ups, but with in one single roll-up (market segments) the same element is appearing twice.


I was hoping to write a process that would do something similar to the following:

IF element exists more than once in a given roll-up,
Delete all those elements, then, Create that element once.
Else,
STET

Any thoughts? I am relatively new to TM1, I have been working on it all day every day for a month and a half now.

THANKS!

Re: TM1 Duplicate Element Delete Process

Posted: Fri Oct 15, 2010 8:02 pm
by tomok
Is it appearing more than once in the actual dimension or just more than once when you are looking through the subset editor? There is a huge difference.

Re: TM1 Duplicate Element Delete Process

Posted: Fri Oct 15, 2010 8:06 pm
by mastertito4
Both.

it shows up 11 times in the actual dimension, when there is only different 9 roll-ups.

Re: TM1 Duplicate Element Delete Process

Posted: Fri Oct 15, 2010 8:11 pm
by kpk
It is probably a slowly changing dimension hierarchy therefore you need to destroy the hierarchy in the prolog session everytime before rebuilding it.

dimension='aaa';

num_of_elements=DIMSIZ(dimension);
index1=1;
while(index1<=num_of_elements);
element=DIMNM(dimension, index1);
num_of_parents=ELPARN(dimension,element);
index2=1;
while(index2<=num_of_parents);
parent=elpar(dimension,element,1);
DimensionElementComponentDelete(dimension,parent,element);
index2=index2+1;
end;
index1=index1+1;
end;

Re: TM1 Duplicate Element Delete Process

Posted: Fri Oct 15, 2010 8:16 pm
by mastertito4
I will give that a shot.

Thank you very much Peter!

Re: TM1 Duplicate Element Delete Process

Posted: Fri Oct 15, 2010 8:19 pm
by kpk

Re: TM1 Duplicate Element Delete Process

Posted: Wed Nov 03, 2010 2:19 pm
by mastertito4
Found the problem,

in the data source we were seeing elements named something like

PARTNUMBER 111 234 456X

and

PARTNUMBER111234456X,

TM1 was loading both of these into the same roll-up and making both of them in the first format
"PARTNUMBER 111 234 456X"

Not quite sure why it got rid of the spaces in the second one, but it did.

Re: TM1 Duplicate Element Delete Process

Posted: Wed Nov 03, 2010 2:30 pm
by Paul Segal
mastertito4 wrote:Not quite sure why it got rid of the spaces in the second one, but it did.
As we know, Jim, TM1 always disregards spaces in element names. PARTNUMBER 1111 is the same element as PARTNUMBER1111 as fas as TM1 is concerned.

Best