John Hammond wrote:As always, Thank You Alan and LotsaRam for your replies.
Even with option #3 I still cannot get this to work even I enter the DatasourceNameForServer= pCubeName; # alt 3
NB DatasourceCubeView works fine as always.
This is even if I use the exact cube and view that I have set up as a datasource.
I shall post my code which is a general utility to work out the size of a cube/view and post a checksum. This works if you manually change the view but does not when you enter parameters.
If anyone has any ideas/could test on rel other than 9.4.1 - any help would be appreciated
Code: Select all
# prolog
# cube_stats - shows statistics for a cube - does not work under TM1 9.4.1
#
# pCubeName (Default: None) - None use cube and view in datasource screen
# pViewName (Default: Whole Cube) - Whole Cube - create view of whole cube as input.
# pExcludeCalcsFromView (Default Y) - not used yet)
String_Count = 0 ;
Number_Count = 0 ;
checksum = 0 ;
IF (pCubeName @<> 'None') ;
DataSourceType = 'VIEW' ;
DatasourceNameForServer=pCubeName;
# tried this just in case...
# DatasourceNameForClient=pCubeName;
IF (pViewName @= 'Whole Cube') ;
# create view of whole cube
ViewName = '_cube_stats' ;
ViewDestroy(pCubeName, ViewName);
ViewCreate(pCubeName, ViewName);
ENDIF ;
DatasourceCubeview= pViewName ;
ENDIF ;
#ELSE - Use the cube and view entered into the tabs
Code: Select all
# must be in metadata to work
IF (VALUE_IS_STRING=1);
string_count = string_count + 1 ;
ELSE ;
checksum = checksum + NVALUE ;
ENDIF ;
number_Count = number_Count + 1 ;
Code: Select all
# epilog
outfile = 'c:\_cube_stats.txt' ;
asciioutput(outfile,'Processing Cube ' | DatasourceNameForServer ) ;
asciioutput(outfile,'Processing View ' | DatasourceCubeview) ;
asciioutput(outfile,'Total ' | numbertostring(number_count)) ;
asciioutput(outfile,'Strings ' | numbertostring(String_count)) ;
asciioutput(outfile,'Checksum ' | numbertostring(checksum)) ;
I'm betting that this is choking for you when you use the "Whole Cube" method, right? (Because it works fine for me if you use a pre-existing view.)
Let's step through what's happening there:
IF (pViewName @= 'Whole Cube') ;
If the parameter has the value "Whole Cube" then...
ViewName = '_cube_stats' ;
ViewDestroy(pCubeName, ViewName);
ViewCreate(pCubeName, ViewName);
You create a view called _cube_stats, but...
DatasourceCubeview= pViewName ;
You're not assigning the view that you just created, you're assigning the original parameter value "Whole Cube"... which is a view name that doesn't exist. Just to reiterate, the view that you created was named "_Cube_Stats", not "Whole Cube". You'd therefore need to assign the ViewName variable, not the pViewName variable, to DatasourceCubeview.
# must be in metadata to work
Works in Data as well; in fact that would be the correct place for it.