Page 1 of 1
TI process will not input from View entered as Parameters
Posted: Sun Feb 28, 2010 8:09 pm
by John Hammond
I am attempting to read a view that I input at run time as Parameters
This is code in my prolog.
Code: Select all
DataSourceType='VIEW';
DatasourceNameForServer= 'TM1 Server - deva:' | pCubeName; # alt 1
DatasourceNameForServer= 'Local:' | pCubeName; # alt 2
DatasourceNameForServer= pCubeName; # alt 3
DatasourceCubeview= pViewName ;
None of the alternatives for entering the name of the cube works. Can anyone help?
The message I get if I enter the cube name as cbcMMRABF for alt 1 is
Error: Prolog procedure line (0): Unable to open data source "TM1 Server - deva:cbcMMRABF".
Out of interest if I can get this to work can I enter
"another server:cubename" and pull in data from another server?
As always thanks in advance for any suggestions.
Re: TI process will not input from View entered as Parameters
Posted: Sun Feb 28, 2010 8:17 pm
by Alan Kirk
John Hammond wrote:I am attempting to read a view that I input at run time as Parameters
This is code in my prolog.
Code: Select all
DataSourceType='VIEW';
DatasourceNameForServer= 'TM1 Server - deva:' | pCubeName; # alt 1
DatasourceNameForServer= 'Local:' | pCubeName; # alt 2
DatasourceNameForServer= pCubeName; # alt 3
DatasourceCubeview= pViewName ;
None of the alternatives for entering the name of the cube works. Can anyone help?
The message I get if I enter the cube name as cbcMMRABF for alt 1 is
Error: Prolog procedure line (0): Unable to open data source "TM1 Server - deva:cbcMMRABF".
Out of interest if I can get this to work can I enter
"another server:cubename" and pull in data from another server?
As always thanks in advance for any suggestions.
DatasourceNameForServer changes the cube name.
DatasourceCubeview changes the View name.
Therefore what you have as Alt3 should work... provided that the inputs are correct and that you don't have (for example) a colon after the cube name.
I'd AsciiOutput the parameter values before attempting to assign the data source just to confirm that they are what you think they are.
Re: TI process will not input from View entered as Parameters
Posted: Mon Mar 01, 2010 3:18 am
by lotsaram
John Hammond wrote:Out of interest if I can get this to work can I enter "another server:cubename" and pull in data from another server?
To answer your question
NO!
If you want to connect to another TM1 server as a datasource you need to connect via ODBO with an MDX query.
In case it wasn't clear from Alan's response you do not need to specify the server instance since by definition the server is in it's own self-contained TM1 bubble, simply DatasourceNameForServer = <your cube name> and DatasourceCubeview = <your view name>
Re: TI process will not input from View entered as Parameters
Posted: Wed Mar 03, 2010 8:26 am
by John Hammond
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)) ;
Re: TI process will not input from View entered as Parameters
Posted: Wed Mar 03, 2010 10:46 am
by Alan Kirk
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.
Re: TI process will not input from View entered as Parameters
Posted: Wed Mar 03, 2010 1:31 pm
by John Hammond
Doh! Schoolboy error (though compounded by the TM1 error message which did not mention the view)
Thanks Alan.