Page 1 of 1

Copy Process Error - Could not Intialize the process

Posted: Tue Jan 24, 2012 6:01 am
by Acc_Moonwalk
Hi All, I am trying to write the copy process.
I have 6 dimensions in my cube , I am trying to copy from one channel to other channel and one budget version to other budget version.
in the Subprocess i am copying the data :
Main process code:
vCube = 'Sales_Plan';
vView = 'Sales_plane_View';
vSub = 'Sales_Plan_Sub';

ViewDestroy(vCube,vView);

SubsetDestroy('Subsidiaries',vSub);
SubsetDestroy('Channel',vSub);
SubsetDestroy('Products',vSub);
SubsetDestroy('Versions',vSub);
SubsetDestroy('sales_plan_Measures',vSub);
SubsetDestroy('Months',vSub);


SubsetCreatebyMDX(vSub,'{TM1FILTERBYLEVEL( {TM1SUBSETALL( [Subsidiaries] )}, 0)} ' );
SubsetCreatebyMDX(vSub,'{TM1FILTERBYLEVEL( {TM1SUBSETALL( [Channel] )}, 0)} ' );
SubsetCreatebyMDX(vSub,'{TM1FILTERBYLEVEL( {TM1SUBSETALL( [Products] )}, 0)} ' );
SubsetCreate('Versions',vSub);
SubsetElementInsert('Versions',vSub,pBudgetTarget,1);
SubsetCreatebyMDX(vSub,'{TM1FILTERBYLEVEL( {TM1SUBSETALL( [Sales_Plan_Measures] )}, 0)} ' );
SubsetCreatebyMDX(vSub,'{TM1FILTERBYLEVEL( {TM1SUBSETALL( [Months] )}, 0)} ' );

ViewCreate(vCube,vView);

ViewSubsetAssign(vCube,vView,'Subsidiaries',vSub);
ViewSubsetAssign(vCube,vView,'Channel',vSub);
ViewSubsetAssign(vCube,vView,'Products',vSub);
ViewSubsetAssign(vCube,vView,'Versions',vSub);
ViewSubsetAssign(vCube,vView,'Sales_Plan_Measures',vSub);
ViewSubsetAssign(vCube,vView,'Months',vSub);

ViewZeroOut(vCube,vView);

ViewDestroy(vCube,vView);

SubsetDestroy('Subsidiaries',vSub);
SubsetDestroy('Channel',vSub);
SubsetDestroy('Products',vSub);
SubsetDestroy('Versions',vSub);
SubsetDestroy('sales_plan_Measures',vSub);
SubsetDestroy('Months',vSub);


SubsetCreatebyMDX(vSub,'{TM1FILTERBYLEVEL( {TM1SUBSETALL( [Subsidiaries] )}, 0)} ' );
SubsetCreatebyMDX(vSub,'{TM1FILTERBYLEVEL( {TM1SUBSETALL( [Channel] )}, 0)} ' );
SubsetCreatebyMDX(vSub,'{TM1FILTERBYLEVEL( {TM1SUBSETALL( [Products] )}, 0)} ' );
SubsetCreate('Versions',vSub);
SubsetElementInsert('Versions',vSub,pBudgetSource,1);
SubsetCreatebyMDX(vSub,'{TM1FILTERBYLEVEL( {TM1SUBSETALL( [Sales_Plan_Measures] )}, 0)} ' );
SubsetCreatebyMDX(vSub,'{TM1FILTERBYLEVEL( {TM1SUBSETALL( [Months] )}, 0)} ' );

ViewCreate(vCube,vView);

ViewSubsetAssign(vCube,vView,'Subsidiaries',vSub);
ViewSubsetAssign(vCube,vView,'Channel',vSub);
ViewSubsetAssign(vCube,vView,'Products',vSub);
ViewSubsetAssign(vCube,vView,'Versions',vSub);
ViewSubsetAssign(vCube,vView,'Sales_Plan_Measures',vSub);
ViewSubsetAssign(vCube,vView,'Months',vSub);

ViewExtractSkipRuleValuesSet (vCube,vView, 1);


ExecuteProcess('Sales_Plan', 'pView',vView, 'pChannelTarget', pChannelTarget, 'pBudgetTarget', pBudgetTarget);

ViewDestroy(vCube,vView);

SubsetDestroy('Subsidiaries',vSub);
SubsetDestroy('Channel',vSub);
SubsetDestroy('Products',vSub);
SubsetDestroy('Versions',vSub);
SubsetDestroy('sales_plan_Measures',vSub);
SubsetDestroy('Months',vSub);

Subprocess Code:
In Data Tab:
CellPutN(Value, 'Sales_plan',Subsidiaries, pChannelTarget,Products, pBudgetTarget,Sales_Plan_Measures,Months);

Error I am getting when i click on Run :
5364 ERROR 2012-01-24 05:54:36,885 TM1.Process Process "Copy Process": Could not initialize process
Can you please help on this error
Regards
Ashok

Re: Copy Process Error - Could not Intialize the process

Posted: Tue Jan 24, 2012 6:10 am
by Gregor Koch
Hi

Generally I would avoid dynamic subsets in your copy process, but that is (probably) not why you get your error.

I guess your ExecuteProcess line either has a wrong process or parameter name in it.

Why don't you have a look at copy processes at http://www.BedrockTM1.org, you might be able to use existing processes or get an idea on how to better do what you need to do.

Re: Copy Process Error - Could not Intialize the process

Posted: Tue Jan 24, 2012 6:35 pm
by Edward Stuart
Hi,

Are you calling the process you are running? This could be another reason for it falling over,

Edd

Re: Copy Process Error - Could not Intialize the process

Posted: Tue Jan 24, 2012 8:10 pm
by Wim Gielis
For debugging purposes, I would not destroy the view and the subsets.
See whether they contain the expected elements / data.
Beware: such a view can be large and consume a lot of memory if you try to open it.
First check the subsets, then the view.

Next to that, why do you create the subsets, destroy them and create them again (exactly the same code)?
You can also clean up these temporary objects in the Epilog part of the process.

As mentioned above, you should check the hard-coded elements (names of process, cube and so on).
Use ASCIIOUTPUT to output text to a file.

@Gregor:

Why would you avoid dynamic subsets in processes like these? It avoids loops which could be endless with a simple oversight (I did this in the past...).
Only caveat is that MDX'es should have at least 1 element. Other than that, I almost ALWAYS use them in processes like this, unless the syntax or subset at hand is too complex.
In general, I use a mix of MDX and static subsets, whichever is more practical.

Re: Copy Process Error - Could not Intialize the process

Posted: Tue Jan 24, 2012 9:27 pm
by lotsaram
Wim Gielis wrote:Why would you avoid dynamic subsets in processes like these? It avoids loops which could be endless with a simple oversight (I did this in the past...).
Only caveat is that MDX'es should have at least 1 element. Other than that, I almost ALWAYS use them in processes like this, unless the syntax or subset at hand is too complex.
In general, I use a mix of MDX and static subsets, whichever is more practical.
Hi Wim, I can think of one very compelling reason, performance. In the code example here the first time vView is used it is to do a ViewZeroOut, in which case I agree dynamic subsets vs. static ones doesn't matter since the subsets are only evaluated once (but I'd still argue against assigning a dynamic ALL subset to a view for this purpose as it is unnecessary. Better and more efficient just to not assign anything for those dimensions ...) However for the 2nd part of the code where vView is rebuilt and passed as a parameter to a process, presumably as a data source, then this is much better using static subsets due to the potential performance impact of the data source being re-evaluated with each record processed.

While I agree MDX can be more efficient than a while loop for code efficiency, this assumes you are writing code from scratch each time. I have pretty much converted to using bedrock for most things like this now which means something like the example from the OP can be achieved in about 5 lines of new code which is a real advantage from having a common library of "functionalized" TI processes. (Not to mention the advantages for newer developers who also get the advantage of fully unit tested functions with optional debugging output.)