TI process will not input from View entered as Parameters

Post Reply
John Hammond
Community Contributor
Posts: 300
Joined: Mon Mar 23, 2009 10:50 am
OLAP Product: PAW/PAX 2.0.72 Perspectives
Version: TM1 Server 11.8.003
Excel Version: 365 and 2016
Location: South London

TI process will not input from View entered as Parameters

Post 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.
Alan Kirk
Site Admin
Posts: 6647
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: TI process will not input from View entered as Parameters

Post 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.
"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.
lotsaram
MVP
Posts: 3703
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: TI process will not input from View entered as Parameters

Post 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>
John Hammond
Community Contributor
Posts: 300
Joined: Mon Mar 23, 2009 10:50 am
OLAP Product: PAW/PAX 2.0.72 Perspectives
Version: TM1 Server 11.8.003
Excel Version: 365 and 2016
Location: South London

Re: TI process will not input from View entered as Parameters

Post 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)) ;
Alan Kirk
Site Admin
Posts: 6647
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: TI process will not input from View entered as Parameters

Post 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.
"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.
John Hammond
Community Contributor
Posts: 300
Joined: Mon Mar 23, 2009 10:50 am
OLAP Product: PAW/PAX 2.0.72 Perspectives
Version: TM1 Server 11.8.003
Excel Version: 365 and 2016
Location: South London

Re: TI process will not input from View entered as Parameters

Post by John Hammond »

Doh! Schoolboy error (though compounded by the TM1 error message which did not mention the view)

Thanks Alan.
Post Reply