CubeExists returns 0 even the cube exists
-
- Posts: 110
- Joined: Sat Nov 06, 2010 10:10 am
- OLAP Product: Cognos TM1
- Version: 10.2.2
- Excel Version: Excel 2013
CubeExists returns 0 even the cube exists
Hi all,
I found a strange behavior of CubeExists function.
I have several cubes on a TM1 server. For some of them CubeExists returns 1 but for some others it returns 0.
Does anyone know why is that? I haven't found any difference between these cubes...
BR
Vladino
I found a strange behavior of CubeExists function.
I have several cubes on a TM1 server. For some of them CubeExists returns 1 but for some others it returns 0.
Does anyone know why is that? I haven't found any difference between these cubes...
BR
Vladino
- qml
- MVP
- Posts: 1097
- Joined: Mon Feb 01, 2010 1:01 pm
- OLAP Product: TM1 / Planning Analytics
- Version: 2.0.9 and all previous
- Excel Version: 2007 - 2016
- Location: London, UK, Europe
Re: CubeExists returns 0 even the cube exists
Are you absolutely sure you've eliminated any human error like typos?vladino wrote:I found a strange behavior of CubeExists function.
I have several cubes on a TM1 server. For some of them CubeExists returns 1 but for some others it returns 0.
Does anyone know why is that? I haven't found any difference between these cubes...
What are the contents (if any) of the weird_cubes.txt file when you run the bellow code snippet in a TI process?
Code: Select all
nDimSize = DIMSIZ( '}Cubes' );
i = 1;
WHILE( i <= nDimSize );
sCube = DIMNM( '}Cubes', i );
IF( CubeExists( sCube ) = 0 );
ASCIIOUTPUT( 'weird_cubes.txt', sCube );
ENDIF;
i = i + 1;
END;
Kamil Arendt
-
- Posts: 110
- Joined: Sat Nov 06, 2010 10:10 am
- OLAP Product: Cognos TM1
- Version: 10.2.2
- Excel Version: Excel 2013
Re: CubeExists returns 0 even the cube exists
I was absolutely sure before I ran your code... This is really strange.qml wrote: Are you absolutely sure you've eliminated any human error like typos?
What are the contents (if any) of the weird_cubes.txt file when you run the bellow code snippet in a TI process?
Code: Select all
nDimSize = DIMSIZ( '}Cubes' ); i = 1; WHILE( i <= nDimSize ); sCube = DIMNM( '}Cubes', i ); IF( CubeExists( sCube ) = 0 ); ASCIIOUTPUT( 'weird_cubes.txt', sCube ); ENDIF; i = i + 1; END;
I'm running Bedrock's ExportViewToFile using exactly the same approach as you have in your code (i.e. looping over }Cubes dim). That's where I found this problem - when the code passes sCube into Bedrock's process it checks whether the cube exists or not. And it returns error for one specific cube.
So I prepared a small TI code with the name of the affected cube in local string variable. And it throws an error. But when I run your code it gives 1 for all cubes...
Could you explain this behavior? Because I don't understand...
BR
Vladislav
EDIT: Before I'm calling ViewExportToFile I'm calling View.Create with the same sCube parameter. The view is created but the data is not exported as ViewExportToFile returns error. But View.Create also checks whether the cube exists and it goes on and creates the view... This is really strange.
-
- Posts: 110
- Joined: Sat Nov 06, 2010 10:10 am
- OLAP Product: Cognos TM1
- Version: 10.2.2
- Excel Version: Excel 2013
Re: CubeExists returns 0 even the cube exists
Now I'm totally lost...
I have 3 cubes:
ObchodniPlan
ObchodniPlanReport
ObchodniPlanVystup
I have this code:
All above mentioned three cubes returns 0... WHY???
I have 3 cubes:
ObchodniPlan
ObchodniPlanReport
ObchodniPlanVystup
I have this code:
Code: Select all
nDimSize = DIMSIZ( '}Cubes' );
i = 1;
WHILE( i <= nDimSize );
sCube = DIMNM( '}Cubes', i );
IF( CubeExists( sCube ) = 1 );
IF( SUBST(sCube, 1, 8) @= 'Obchodni');
TextOutput('Cubes.txt', sCube, '1');
ELSE;
TextOutput('Cubes.txt', sCube, '0');
ENDIF;
ENDIF;
i = i + 1;
END;
- qml
- MVP
- Posts: 1097
- Joined: Mon Feb 01, 2010 1:01 pm
- OLAP Product: TM1 / Planning Analytics
- Version: 2.0.9 and all previous
- Excel Version: 2007 - 2016
- Location: London, UK, Europe
Re: CubeExists returns 0 even the cube exists
What do you mean exactly? Are they printed out to cubes.txt by your code or not? If they are, even if with a "0" flag next to them, then CubeExists surely returns 1 for them, exactly as expected. The problem would then be in the cube name comparison i.e. the first 8 characters of these cubes' names are not 'Obchodni' at all. There might be an unprintable character in these cubes' names or some typo somewhere, but I really don't think CubeExists is your problem here.vladino wrote:All above mentioned three cubes returns 0... WHY???
Kamil Arendt
-
- Posts: 110
- Joined: Sat Nov 06, 2010 10:10 am
- OLAP Product: Cognos TM1
- Version: 10.2.2
- Excel Version: Excel 2013
Re: CubeExists returns 0 even the cube exists
This was just a test but my problem is the first question - I'm looping over all cubes and passing sCube parameter to View.Create and View.ExportToFile. And these two functions returns 0 for CubeExists but I don't know why. If I would be passing the string variable into it I would understand there might be a typo but I'm passing the sCube parameter which I get from DIMNM function.qml wrote: What do you mean exactly? Are they printed out to cubes.txt by your code or not? If they are, even if with a "0" flag next to them, then CubeExists surely returns 1 for them, exactly as expected. The problem would then be in the cube name comparison i.e. the first 8 characters of these cubes' names are not 'Obchodni' at all. There might be an unprintable character in these cubes' names or some typo somewhere, but I really don't think CubeExists is your problem here.
Code: Select all
nDimSize = DIMSIZ( '}Cubes' );
i = 1;
WHILE( i <= nDimSize );
sCube = DIMNM( '}Cubes', i );
ExecuteProcess('Bedrock.Cube.View.Create',
'pCube',sCube,
'pView','ExportView',
'pFilter','Year: 2016',
'pSuppressZero',1,
'pSuppressConsol',1,
'pSuppressRules',0,
'pDimensionDelim','&',
'pElementStartDelim',':',
'pElementDelim','+',
'pDebug',1
);
ExecuteProcess('Bedrock.Cube.Data.ViewExportToFile',
'pCube',sCube,
'pExportPath','export',
'pExportFile','ExportView.txt',
'pView','ExportView',
'pSkipRuleValues',0,
'pSkipCalcValues',1,
'pSkipNullValues',1,
'pTitleRecord',0,
'pDebug',1
);
i = i + 1;
End;
- qml
- MVP
- Posts: 1097
- Joined: Mon Feb 01, 2010 1:01 pm
- OLAP Product: TM1 / Planning Analytics
- Version: 2.0.9 and all previous
- Excel Version: 2007 - 2016
- Location: London, UK, Europe
Re: CubeExists returns 0 even the cube exists
Sorry, I'm out of ideas then. Do you have another copy of the model and/or another version of TM1 to test it in?
Kamil Arendt
-
- MVP
- Posts: 3240
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.1.5
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: CubeExists returns 0 even the cube exists
Hello,
Do you see the same behaviour after stopping and starting the TM1 model ?
Do you see the same behaviour after stopping and starting the TM1 model ?
Best regards,
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
-
- MVP
- Posts: 3704
- Joined: Fri Mar 13, 2009 11:14 am
- OLAP Product: TableManager1
- Version: PA 2.0.x
- Excel Version: Office 365
- Location: Switzerland
Re: CubeExists returns 0 even the cube exists
The }Cubes dimension is compiled at server startup from a listing of all .cub files in the data directories. If however one of the dimensions in the cube ISN'T present in the directory then the cube won't load and be available on the server. (But it will still be in the }Cubes dimension). Such "cubes" would return 0 to CubeExists.
I think this might explain your situation. So
- do you have any cube load errors on startup?
- have you trapped the names of the cubes causing the error and are they actually present in the server?
I think this might explain your situation. So
- do you have any cube load errors on startup?
- have you trapped the names of the cubes causing the error and are they actually present in the server?
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
-
- Posts: 110
- Joined: Sat Nov 06, 2010 10:10 am
- OLAP Product: Cognos TM1
- Version: 10.2.2
- Excel Version: Excel 2013
Re: CubeExists returns 0 even the cube exists
Hello guys,
thank you all for your valuable posts.
I have restarted the TM1 service and voila - now it works!
It's weird because there were no changes in the model so I don't understand it. There were no cube load errors, all cubes and dimensions are on the server...
Anyway, the problem is solved for now.
Thanks again!
Vladino
thank you all for your valuable posts.
I have restarted the TM1 service and voila - now it works!
It's weird because there were no changes in the model so I don't understand it. There were no cube load errors, all cubes and dimensions are on the server...
Anyway, the problem is solved for now.
Thanks again!
Vladino