Possible Bug - TI Fails to Read Dynamic Subset

Post Reply
User avatar
Steve Vincent
Site Admin
Posts: 1054
Joined: Mon May 12, 2008 8:33 am
OLAP Product: TM1
Version: 10.2.2 FP1
Excel Version: 2010
Location: UK

Possible Bug - TI Fails to Read Dynamic Subset

Post by Steve Vincent »

Not sure if this is specific to my version or not. Would be interesting if someone could test on a later version before i submit another bug report to Cognos ;)

TM1 9.0.3 182 U7 running on Win Server 2003 Standard

I have a TI which is based on a dynamic subset of the employees dimension. The subset is basic enough, just grabs all level 0 elements on A to Z order

Code: Select all

{TM1SORT( {TM1FILTERBYLEVEL( {TM1SUBSETALL( [Employees] )}, 0)}, ASC)}
The TI i am writing is designed to locate possible duplicate clock numbers. We have a fantastic system that allows leading zeros for clock numbers, sometimes users will open a CSV with Excel and it'll loose those leading zeroes. Yes, i have told them not to do that but people make mistakes and so i have a mess of an employees dimension i'd like to fix, as i have loads of duplicate clocks like "0001234" and "1234".

The TI code is below. Its a WIP so i might not being doing this the most efficient way, if anyone has any improvements feel free to suggest them!

(all in the data tab, nowt else)

Code: Select all

ClockSize = LONG ( clock );
Ch1 = SUBST ( clock , 1 , 1);
Ch2 = SUBST ( clock , 2 , 1);
Ch3 = SUBST ( clock , 3 , 1);
Ch4 = SUBST ( clock , 4 , 1);
Ch5 = SUBST ( clock , 5 , 1);
Ch6 = SUBST ( clock , 6 , 1);
Ch7 = SUBST ( clock , 7 , 1);

IF ( Ch1 @<> '0' );
    ItemSkip;
EndIF;


#try to locate the CSS clocks
IF ( Ch1 @= '0' & Ch2 @<> '0' & ClockSize = 7 );
    MatchSize = 6;
    ClockMatch = SUBST ( clock , 2 , MatchSize );
EndIF;

IF ( Ch1 @= '0' & Ch2 @= '0' & Ch3 @<> '0' & ClockSize = 7 );
    MatchSize = 5;
    ClockMatch = SUBST ( clock , 3 , MatchSize );
EndIF;

IF ( Ch1 @= '0' & Ch2 @= '0' & Ch3 @= '0' &  Ch4 @<>'0' & ClockSize = 7 );
    MatchSize = 4;
    ClockMatch = SUBST ( clock , 4 , MatchSize );
EndIF;

IF ( Ch1 @= '0' & Ch2 @= '0' & Ch3 @= '0' & Ch4 @= '0' & Ch5 @<>'0' & ClockSize = 7 );
    MatchSize = 3;
    ClockMatch = SUBST ( clock , 5 , MatchSize );
EndIF;

IF ( Ch1 @= '0' & Ch2 @= '0' & Ch3 @= '0' & Ch4 @= '0' & Ch5 @= '0' & Ch6 @<>'0' & ClockSize = 7 );
    MatchSize = 2;
    ClockMatch = SUBST ( clock , 6 , MatchSize );
EndIF;

IF ( Ch1 @= '0' & Ch2 @= '0' & Ch3 @= '0' & Ch4 @= '0' & Ch5 @= '0' & Ch6 @= '0' & Ch7 @<>'0' & ClockSize = 7 );
    MatchSize = 1;
    ClockMatch = SUBST ( clock , 7 , MatchSize );
EndIF;

###########################################


IF ( AttrS ( 'Employees' , Clock , 'Duplicate' ) @<> '');
    ItemSkip;
EndIF;


IF ( DimIX ( 'Employees' , ClockMatch ) <> 0 );
    AttrPutS ( Clock , 'Employees' , Clock , 'Duplicate' );
    AttrPutS ( Clock , 'Employees' , ClockMatch , 'Duplicate' );
EndIF;
My problem is that the dimension has 26,000 elements and its trying to check each one 26,000 times. I know it needs to do that to find the duplicates, but the effect of looking at 26000 x 26000 data points (676 Million!) is a very long wait. Anyway, after a few mins of running i cancelled it to check how it was progressing and doing so killed the TI. When i went back to the datasource tab, the dim subset was blank, but if you check the same subset from the subset editior its fine :(

Closing the TI and re-opening it doesn't work. Logging off and on also doesn't. Even creating a new TI from scratch fails to give me any data, the only solution has been to restart the service.

Can anyone else reproduce this on a later version, or know if its fixed in a later release?

TIA
If this were a dictatorship, it would be a heck of a lot easier, just so long as I'm the dictator.
Production: Planning Analytics 64 bit 2.0.5, Windows 2016 Server. Excel 2016, IE11 for t'internet
User avatar
Alan Kirk
Site Admin
Posts: 6606
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: Possible Bug - TI Fails to Read Dynamic Subset

Post by Alan Kirk »

Steve Vincent wrote:Not sure if this is specific to my version or not. Would be interesting if someone could test on a later version before i submit another bug report to Cognos ;)

TM1 9.0.3 182 U7 running on Win Server 2003 Standard

I have a TI which is based on a dynamic subset of the employees dimension. The subset is basic enough, just grabs all level 0 elements on A to Z order

Code: Select all

{TM1SORT( {TM1FILTERBYLEVEL( {TM1SUBSETALL( [Employees] )}, 0)}, ASC)}
The TI i am writing is designed to locate possible duplicate clock numbers. We have a fantastic system that allows leading zeros for clock numbers, sometimes users will open a CSV with Excel and it'll loose those leading zeroes. Yes, i have told them not to do that but people make mistakes and so i have a mess of an employees dimension i'd like to fix, as i have loads of duplicate clocks like "0001234" and "1234".

The TI code is below. Its a WIP so i might not being doing this the most efficient way, if anyone has any improvements feel free to suggest them!

(all in the data tab, nowt else)

{Code snipped for brevity}

My problem is that the dimension has 26,000 elements and its trying to check each one 26,000 times. I know it needs to do that to find the duplicates, but the effect of looking at 26000 x 26000 data points (676 Million!) is a very long wait. Anyway, after a few mins of running i cancelled it to check how it was progressing and doing so killed the TI. When i went back to the datasource tab, the dim subset was blank, but if you check the same subset from the subset editior its fine :(

Closing the TI and re-opening it doesn't work. Logging off and on also doesn't. Even creating a new TI from scratch fails to give me any data, the only solution has been to restart the service.

Can anyone else reproduce this on a later version, or know if its fixed in a later release?
OK, first things first. I can't reproduce this in 9.4 (original release). Unfortunately Tuesday's my busy day and I wasn't able to test it on 9.1 SP3 (haven't installed SP4 yet) nor 8.2.12, though I doubt you'll be interested in the last one anyway. Will let you know what I encounter in 9.1, though you probably won't want to migrate over just this bug even if it works.

But in 9.4, the Preview button will bring up all of the elements of the subset in the window, happy as little clams.

But now to second things.

If I understand you correctly:
- The proper, bona fide clock numbers will all have 7 characters with leading 0's;
- The User-Induced potential duplicates will therefore have fewer characters; but
- They'll only be duplicates if the corresponding 7-character-with-leading-zero element is also there.

If so, I wouldn't bother looping through the elements more than once, since you'll be able to find the dups on the first pass. The following code doesn't use any data source, and goes in the Prolog. I've got it looping through the whole dim; my belief is that it would work well enough if you changed it to loop through an N level dynamic subset, but if you don't trust that in your version this probably won't take a significantly greater amount of time unless you have a consolidation for almost every element or something.

I used it with a 4600 element dimension with about a dozen induced duplicates, and it was "blink of an eye" stuff.

Code: Select all


SC_DIM_NAME = 'Employees';

# No particular reason why you couldn't iterate through an N level
# dynamic subset instead, but if you don't trust it we can
# do the whole dim.

l_DimLen = DimSiz( SC_DIM_NAME );

l_DimIdx = 1;

While ( l_DimIdx <= l_DimLen);

    s_Element = DimNm( SC_DIM_NAME, l_DimIdx );

    l_ElLev = ElLev ( SC_DIM_NAME, s_Element);

    l_ElNameLen = Long ( s_Element);

    If ( l_ElLev = 0 & l_ElNameLen < 7);

# Get the name of the element with padded 0's
       s_LongName = Fill ( '0', 7 - l_ElNameLen) | s_Element;

        If ( DimIx ( SC_DIM_NAME, s_LongName) > 0);

            AttrPutS ( s_LongName , SC_DIM_NAME , s_Element , 'Duplicate' );

            AttrPutS ( s_Element , SC_DIM_NAME , s_LongName , 'Duplicate' );

        EndIf;

    EndIf;

    l_DimIdx = l_DimIdx + 1;

End;
Now drifting off topic slightly, and I'll post a proper thread when I figure out what's going on here, there's a big ol' gotcha with the new, improved 9.4.

I got a bit sloppy in writing the code above, and forgot to increment the index. Hey, I wrote it on the train on the way home and was distracted by the sight of a group of wallopers (that's "cops", Eric... "fuzz"? "Da man?") hog-tying a fat bald guy with glasses on the platform of one of the stations as I went past. Certainly something that I don't NORMALLY see from my office window. Anyway, I forgot to put the increment line in... which put the thing into an infinite loop.

So I used the standard back-out procedure when you don't have TM1 Top available. (Cursing under breath, then killing Excel and the local server along with it.) When I restarted Excel and the server, the server went to 50% processor usage and just hung there. It had started as an Application and when I went to the window I could see why; it had RE-DONE everything that happened before the crash, INCLUDING triggering the process.

I'm guessing that this has something to do with the new metadata logging feature. I killed Excel again, yanked every .log file I could find out of the system, and restarted with no problem.

Just something to watch for if you're in 9.4. (Sorry for slightly threadjacking there Steve.) When I confirm exactly where this cute little issue stems from, I'll post more details. But for now... it's DINNER TIME!
Last edited by Alan Kirk on Tue Oct 21, 2008 9:31 am, edited 2 times in total.
Reason: 4600 element DIMENSION, not "consolidation"
"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.
User avatar
Alan Kirk
Site Admin
Posts: 6606
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: Possible Bug - TI Fails to Read Dynamic Subset

Post by Alan Kirk »

Alan Kirk wrote:I can't reproduce this in 9.4 (original release). Unfortunately Tuesday's my busy day and I wasn't able to test it on 9.1 SP3 (haven't installed SP4 yet) nor 8.2.12, though I doubt you'll be interested in the last one anyway. Will let you know what I encounter in 9.1,
No problem in 8.2.12 or 9.1 SP3 either.

The test that I did was to:
- Run the code in my last post which flagged the duplicates;
- Created an N level subset using your own MDX;
- Used that subset as the data source for the following process (all code in the Data tab):

Code: Select all

s_DupAttr = AttrS('Employees', Employees, 'Duplicate');

If ( s_DupAttr @= '');
   ItemSkip;
Else;
   AsciiOutput( 'D:\TM1\Temp\Dups.txt', 'Element', Employees, 'Duplicate', s_DupAttr);
EndIf;
All of the duplicated elements found were spat out correctly, which meant that it must have been processing the elements correctly. In both cases (8.2.12 and 9.1 SP3), I was able to see the data (i.e., the elements) on the Data Source tab after clicking on the Preview button.

It might be an idea to try just AsciiOutputting the elements from your subset to see whether it's an issue with the GUI only in your version, or whether the TI really isn't seeing the elements.
"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.
User avatar
Steve Vincent
Site Admin
Posts: 1054
Joined: Mon May 12, 2008 8:33 am
OLAP Product: TM1
Version: 10.2.2 FP1
Excel Version: 2010
Location: UK

Re: Possible Bug - TI Fails to Read Dynamic Subset

Post by Steve Vincent »

Alan, thanks so much for all that, its really helped. I did think about not using a data source to start with then for some reason thought it'd be easier against the subset. Thats the way with WIP TIs, sometimes you go the right way and sometimes you don't ;)

As for the bug, that's just baffling me more and more. The subset always dies when the TI is aborted and cannot be reused by any TI unless the server is restarted. But, the same TI using a different subset (but same MDX so same outcome) can be aborted as many times as you like and it doesn't kill the subset. Seems for some reason that specific subset just gets upset. The only thing i can think of that might be contributing is the actual name of the subset itself. The one that breaks is called "Employees - n levels" (no, i didn't name it!!) and the one i created to test is "nodals". I've seen TI struggle when names of elements, dims, cubes and all sorts have special characters in them, so maybe it doesn't like the "-" but i've plenty of other subsets with things like that in and its the first time i've seen this happen... :?
If this were a dictatorship, it would be a heck of a lot easier, just so long as I'm the dictator.
Production: Planning Analytics 64 bit 2.0.5, Windows 2016 Server. Excel 2016, IE11 for t'internet
User avatar
paulsimon
MVP
Posts: 808
Joined: Sat Sep 03, 2011 11:10 pm
OLAP Product: TM1
Version: PA 2.0.5
Excel Version: 2016
Contact:

Re: Possible Bug - TI Fails to Read Dynamic Subset

Post by paulsimon »

Steve

I had a related problem with an MDX subset on 9.0.3 where this subset frequently led to crashes when using TI to read from Views containing it. Re-generating the MDX didn't help. After a crash I would find the tell tale .sub$ version of the file. It was a bit of a pain as it was used in a number of views, so I couldn't delete it. In the end I had to delete the views, and then delete the subset and then re-create it, and then re-create the views. After that I had no problems. I suspect that the problem relates to TM1's caching of subset results on MDX subsets. I haven't had the problem since moving to 9.1. However, I had lots of other MDX subsets on 9.0.3 and they all worked fine. It was just this one. It seemed to have got corrupt somehow.

Regards

Paul Simon
User avatar
Steve Vincent
Site Admin
Posts: 1054
Joined: Mon May 12, 2008 8:33 am
OLAP Product: TM1
Version: 10.2.2 FP1
Excel Version: 2010
Location: UK

Re: Possible Bug - TI Fails to Read Dynamic Subset

Post by Steve Vincent »

Cheers, just checked and i have no .sub$ version but i think you are right on the corrupted subset. Still confusing that a service restart will fix it, but i'm just glad this is in my dev server so i don't have to worry about fixing all the views that use it :)
If this were a dictatorship, it would be a heck of a lot easier, just so long as I'm the dictator.
Production: Planning Analytics 64 bit 2.0.5, Windows 2016 Server. Excel 2016, IE11 for t'internet
Post Reply