Copy from multiple views in one process

Post Reply
Joris
Posts: 21
Joined: Wed Sep 30, 2015 2:19 pm
OLAP Product: TM1
Version: 10_2_2
Excel Version: 2010

Copy from multiple views in one process

Post by Joris »

I've got a TI process that creates two views. The data of those views is then copied to a target cube. However, in the "Data Source" tab, selecting "IBM Cognos TM1 Cube View" as Datasource Type, I can only choose one View.

So I was thinking, is there a possibility to do something like this (would be done completely in Prolog then I assume)?

Code: Select all

Create ViewA
For(all elements in ViewA);
	CellPutN(in targetCube);
Next;

Create ViewB
For(all elements in ViewB);
	CellPutN(in targetCube);
Next;
So what I'm actually asking is this: is it possible to loop through all elements in a view and putting them in a cube like this?

Of course, if there is a more elegant way that would be even better.

Thanks
Joris
User avatar
jim wood
Site Admin
Posts: 3961
Joined: Wed May 14, 2008 1:51 pm
OLAP Product: TM1
Version: PA 2.0.7
Excel Version: Office 365
Location: 37 East 18th Street New York
Contact:

Re: Copy from multiple views in one process

Post by jim wood »

Most of the time in this kind of situation it's easiest to create a parent process that calls a sub process multiple times. So say in the process you've created set the version (actual, forecast, etc) as parameter, then recreate the source view in prolog. Then override the data source in prolog also. Then in the parent process call the child process twice passing it to different versions.

The above assumes that you need to copy data to the same cube. If they are different you may just want to call 2 seperate processes.
Struggling through the quagmire of life to reach the other side of who knows where.
Go Build a PC
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
lotsaram
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: Copy from multiple views in one process

Post by lotsaram »

No there is no programatic method in TI to iterate through all the cells in a view. You accomplish this by assigning the view as a data source and this happens implicitly on the metadata and data tabs. ( ... well you could loop a subset within a subset withing a subset of dimensions in the cube but this would be incredibly inefficient as it would have no concept of null suppression ...)

A TI process can only have one data source per run but usually the data source for a TI process in any well written process is dynamically assigned and so can be varied depending on the parameters passed to the process. The function you need are
DatasourceType
DatasourceNameForServer
DatasourceCubeView

Then as Jim has indicated all you need is a process to call the worker process multiple times with different datasources.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
Joris
Posts: 21
Joined: Wed Sep 30, 2015 2:19 pm
OLAP Product: TM1
Version: 10_2_2
Excel Version: 2010

Re: Copy from multiple views in one process

Post by Joris »

Thanks for the inspiration.

I solved it calling a bedrock process twice (once for each view), and that seems to work fine.
Moh
Posts: 43
Joined: Fri Aug 01, 2014 5:17 pm
OLAP Product: Cognos
Version: 10.1.1
Excel Version: 2010

Re: Copy from multiple views in one process

Post by Moh »

What is process name.
.
Joris
Posts: 21
Joined: Wed Sep 30, 2015 2:19 pm
OLAP Product: TM1
Version: 10_2_2
Excel Version: 2010

Re: Copy from multiple views in one process

Post by Joris »

Moh wrote:What is process name.
It looks like this:

Code: Select all

Create views... (here called cViewA and cViewB)
.
.
.
ExecuteProcess('Bedrock.Cube.Data.Copy',
	'pCube', cCube,
	'pViewSource', cViewA,
	'pDimension', 'Version',
    'pSourceElement', 'Actuals',
    'pTargetElement', 'Forecast');
ExecuteProcess('Bedrock.Cube.Data.Copy',
	'pCube', cCube,
	'pViewSource', cViewB,
	'pDimension', 'Version',
    'pSourceElement', 'Budget',
    'pTargetElement', 'Forecast');
For example the first view contains the first three months of a year and the 'Actuals', while the other nine months of 'Forecast' are filled with 'Budget'.
Wim Gielis
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: Copy from multiple views in one process

Post by Wim Gielis »

Joris wrote:
Moh wrote:What is process name.
It looks like this:

Code: Select all

Create views... (here called cViewA and cViewB)
.
.
.
ExecuteProcess('Bedrock.Cube.Data.Copy',
	'pCube', cCube,
	'pViewSource', cViewA,
	'pDimension', 'Version',
    'pSourceElement', 'Actuals',
    'pTargetElement', 'Forecast');
ExecuteProcess('Bedrock.Cube.Data.Copy',
	'pCube', cCube,
	'pViewSource', cViewB,
	'pDimension', 'Version',
    'pSourceElement', 'Budget',
    'pTargetElement', 'Forecast');
For example the first view contains the first three months of a year and the 'Actuals', while the other nine months of 'Forecast' are filled with 'Budget'.
Just a small note, if you don't specify parameter values for some of the parameters in the called process,
you will implicitly use the parameters that have been defined at design time in said process.
This could be valid and correct, but might not always be so. I prefer most of the time to set all parameter values of the called processes.
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
Post Reply