Page 1 of 1

Copy from multiple views in one process

Posted: Tue Dec 22, 2015 12:44 pm
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

Re: Copy from multiple views in one process

Posted: Tue Dec 22, 2015 12:55 pm
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.

Re: Copy from multiple views in one process

Posted: Tue Dec 22, 2015 5:12 pm
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.

Re: Copy from multiple views in one process

Posted: Wed Dec 23, 2015 9:43 am
by Joris
Thanks for the inspiration.

I solved it calling a bedrock process twice (once for each view), and that seems to work fine.

Re: Copy from multiple views in one process

Posted: Wed Dec 23, 2015 10:07 am
by Moh
What is process name.
.

Re: Copy from multiple views in one process

Posted: Wed Dec 23, 2015 11:01 am
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'.

Re: Copy from multiple views in one process

Posted: Sat Dec 26, 2015 7:39 pm
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.