Page 1 of 1

TI Process to copy Data with Parameter

Posted: Fri Oct 28, 2011 2:29 pm
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.

Re: TI Process to copy Data with Parameter

Posted: Fri Oct 28, 2011 2:41 pm
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);

Re: TI Process to copy Data with Parameter

Posted: Fri Oct 28, 2011 2:49 pm
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.

Re: TI Process to copy Data with Parameter

Posted: Fri Oct 28, 2011 5:47 pm
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

Re: TI Process to copy Data with Parameter

Posted: Fri Oct 28, 2011 5:55 pm
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.

Re: TI Process to copy Data with Parameter

Posted: Fri Oct 28, 2011 6:59 pm
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.

Re: TI Process to copy Data with Parameter

Posted: Sat Oct 29, 2011 9:00 am
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