TI Process to copy Data with Parameter

Post Reply
Stephan1981
Posts: 7
Joined: Mon Mar 07, 2011 10:25 pm
OLAP Product: TM1
Version: 9.5
Excel Version: 2007

TI Process to copy Data with Parameter

Post by Stephan1981 »

Hello all experts,

I try to create a TI process that copies Data from a specific year/scenario into another year/scenario. The source and target years/scenarios are parameters. All other Dimension elements should be unchanged.

My TI process looks like this:

Parameter Tab:
Year_Source
Scenario_Source
Year_Target
Scenario_Target

Prolog Tab:
ElementIndexYear = DIMIX('Year', Year_Source);
ElementIndexScenario = DIMIX('Scenario', Scenario_Source);
ViewTitleElementSet('CubeName', 'ViewName', 'Year', ElementIndexYear);
ViewTitleElementSet('CubeName', 'ViewName', 'Scenario', ElementIndexScenario);

Data Tab:
Year = Year_Target;
Scenario = Scenario_Target;

if(VALUE_IS_STRING=1;CellPutS(SVALUE, dim1, dim2, Year, Scenario,...),CellPutN(SVALUE, dim1, dim2, Year,Scenario,...)));

When I execute the process, only my 'Actual' data is copied, even though I try it with different elements, e.g. plan,...
Does anybody know why this happens?

I already checked the view and the title dimensions show all elements.
The code in Prolog Tab seems to be working as well.
The cube includes a rule. Deactivating this rule doesn't change anything.
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: TI Process to copy Data with Parameter

Post by tomok »

Why are you wasting time with the DIMIX and ViewTitleElement stuff? That is only for setting the title elements for a view that a user is going to want to open. If you are using it for a data source in a TI process it's a waste of time.

Code: Select all

Cube = 'CubeName';
View = 'ViewName';
Sub = 'SubName';

#=========================================================
# Check if View exists and destroy it if it does then create view
#=========================================================
IF(ViewExists( Cube,View) = 1);
  ViewDestroy( Cube,View);
ENDIF;
ViewCreate(Cube,View);

#=========================================================
# Destroy subset if it exists, create subset based on input, assign to view
#=========================================================
Dim = 'Year';
IF(SubsetExists(Dim,Sub)=1);
  SubsetDestroy(Dim,Sub);
ENDIF;
SubsetCreate(Dim,Sub);
SubsetElementInsert(Dim,Sub,YearSource,1);
ViewSubsetAssign(Cube,View,Dim,Sub);

Dim = 'Scenario';
IF(SubsetExists(Dim,Sub)=1);
  SubsetDestroy(Dim,Sub);
ENDIF;
SubsetCreate(Dim,Sub);
SubsetElementInsert(Dim,Sub,Scenario_Source,1);
ViewSubsetAssign(Cube,View,Dim,Sub);
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
lotsaram
MVP
Posts: 3706
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 to copy Data with Parameter

Post by lotsaram »

For starters ViewTitleElementSet is not relevant for a processing view only for a user view. When a view is used as a TI data source all dimensions are treated as row dimensions.

I imagine that actual contains input data but that your other scenarios are rule based and that you currently have ViewExtractSkipRuleValuesSet set to true for the view in which case and rule derived records won't be copied. But I am only guessing as you haven't given much to go on.

My advice would be to go to the bedrock site and download a pre-written TI process that will do this already for you without you having to code anything.
Wim Gielis
MVP
Posts: 3241
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: TI Process to copy Data with Parameter

Post by Wim Gielis »

Hello Tomok

Talking about waste of time and excessive coding, is there a reason why you use:

IF(ViewExists( Cube,View) = 1);
and
IF(SubsetExists(Dim,Sub)=1);

for the ViewDestroy and SubsetDestroy, respectively?

In my opinion they are not needed.

Wim
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
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: TI Process to copy Data with Parameter

Post by tomok »

Wim Gielis wrote:Hello Tomok

Talking about waste of time and excessive coding, is there a reason why you use:

IF(ViewExists( Cube,View) = 1);
and
IF(SubsetExists(Dim,Sub)=1);

for the ViewDestroy and SubsetDestroy, respectively?

In my opinion they are not needed.

Wim
Because the last time I checked, issuing either of those commands against a view or subset that does not exist throws off an error condition. Just trying to eliminate unnecessary errors that have no bearing on whether or not the process was successful. Maybe that has changed, IDK.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Alan Kirk
Site Admin
Posts: 6667
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 to copy Data with Parameter

Post by Alan Kirk »

tomok wrote:
Wim Gielis wrote:Hello Tomok

Talking about waste of time and excessive coding, is there a reason why you use:

IF(ViewExists( Cube,View) = 1);
and
IF(SubsetExists(Dim,Sub)=1);

for the ViewDestroy and SubsetDestroy, respectively?

In my opinion they are not needed.

Wim
Because the last time I checked, issuing either of those commands against a view or subset that does not exist throws off an error condition. Just trying to eliminate unnecessary errors that have no bearing on whether or not the process was successful. Maybe that has changed, IDK.
If it changed, I don't know when. I was using ViewDestroy and SubsetDestroy without error in my cleanup process (even when the chore was aborted and the views and subsets weren't created) as far back as 8.2.12 without needing to check whether they existed first. It still runs fine in both 9.0 and 9.5. The only time you'll get an error is if you specify a cube or dimension (respectively) that doesn't exist.
"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.
User avatar
Michel Zijlema
Site Admin
Posts: 713
Joined: Wed May 14, 2008 5:22 am
OLAP Product: TM1, PALO
Version: both 2.5 and higher
Excel Version: 2003-2007-2010
Location: Netherlands
Contact:

Re: TI Process to copy Data with Parameter

Post by Michel Zijlema »

tomok wrote:Why are you wasting time with the DIMIX and ViewTitleElement stuff?
Probably because the OP wasn't aware and is visiting the forum to learn some things.

MIchel
Post Reply