Using ATTRS in TI

Post Reply
appleglaze28
Regular Participant
Posts: 269
Joined: Tue Apr 21, 2009 3:43 am
OLAP Product: Cognos TM1, Planning
Version: 9.1 SP3 9.4 MR1 FP1 9.5
Excel Version: 2003

Using ATTRS in TI

Post by appleglaze28 »

I was wondering, if anybody can help me out with this. I'm trying to do a TI where data from an old cube with 3 dimension and transfer it to a new dimension with 4 dimension. Like on a previous post related to this...rather than creating rules, I want to use to TI so I can transfer the data and delete the old cube.

How do you declare the attribute here since it doesn't allow the use of dimension names near the syntax of ATTRS.

I know i need to declare the "model" dimension as a static parameter here but I'm not sure yet cause I can't get pass the error I'm having right now. How different are syntax both useable in Rules & TI to be written.

DATA:

Code: Select all

i = DIMSIZ('product');
while(i>1);
  vprod = DIMNM('product', i);
IF (ATTRS('product', 'vprod', 'model')=!model);
              CellGetS('Sales', !month, !product, !value_sales);
              CellGetN('Sales', !month, !product, !value_sales);
              CellPutS('SalesModel',!model, !month, !product, !value_sales);
              CellPutN('SalesModel',!model, !month, !product, !value_sales);
  i = i - 1;
end;
ATTRS in TI.PNG
ATTRS in TI.PNG (118.08 KiB) Viewed 3614 times
olapuser
Posts: 40
Joined: Fri Jan 29, 2010 1:55 am
OLAP Product: Cognos TM1
Version: 9.5
Excel Version: 2007
Contact:

Re: Using ATTRS in TI

Post by olapuser »

you did not put the closing if (endif) and wrong logical expression

Code: Select all

DimName='product';
NoOfElements=DimSiz(DimName);
index = 1;
WHILE( index<=NoOfElements );
	ElName=DIMNM(DimName, index);
	IF (ATTRS('product', 'vprod', 'model')@=model);
	    CellGetS('Sales', !month, !product, !value_sales);
	    CellGetN('Sales', !month, !product, !value_sales);
	    CellPutS('SalesModel',!model, !month, !product, !value_sales);
    	CellPutN('SalesModel',!model, !month, !product, !value_sales);
    endif;
	index = index+1;
END;
Andy Key
MVP
Posts: 352
Joined: Wed May 14, 2008 1:37 pm
OLAP Product: TM1
Version: 2.5 to PA
Excel Version: Lots
Location: Sydney
Contact:

Re: Using ATTRS in TI

Post by Andy Key »

Just a couple of suggestions:

You should be using a cube view on the old cube as a data source for the TI, so there is no need for any looping.
Once you have this, you will be given variable names that you must replace all your !<dimname> references with.
You don't need quotes around the second parameter to the ATTRS as it is a variable not a fixed string.
You should be using the result of the ATTRS as the value for the Model dimension.
You should do a test of the data type of the cell you are getting before you get it so that you only perform the CellGetS and CellPutS or the CellGetN and CellPutN.
You need to assign the CellGetS/N to a variable.
You need to use this variable as the first parameter of the CellPutS/N.

Apart from that, I would say you are pretty close...
Andy Key
Post Reply