Hi,
I've written a dynamic view using MDX. I would now like to copy the values in this view to another dimension element. One approach would be to import the view into another process and use Cellputn to transfer the value into the new element. But it would be good to be able to do this within the same process. I guess this would be done by looping through the values in the view but what is the best approach to retrieve these values and determine the size of the view to loop through? (does it involve looping through the SubsetGetSize value for each subset?)
Many thanks
Ross
TI process to copy values
- wissew
- Posts: 54
- Joined: Tue Jun 17, 2008 7:24 pm
- OLAP Product: TM1
- Version: 9.5.2; 10.2.2; 11
- Excel Version: 2003 SP3 - 2013
- Location: Beaverton, OR
Re: TI process to copy values
Ross,
Here is some code we use to loop though subsets to load. You need to fill in the blanks.
Wes
DimName =' ';
vSubSet = 'N Elements';
vSubSize = subsetgetsize(DimName,vSubSet);
vSubsetCount = 1;
#***** Limits loop to subset size
While (vSubsetCount <= vSubSize);
#*****Retrieves element number 1 - n
vDimElement=SubsetGetElementName(DimName, vSubSet, vSubsetcount);
vLoadAmt=Cellgetn( )*Value;
#Loads the calculated amount from above!
CellPutN( );
#Continue Looping
vSubsetCount = vSubsetCount + 1;
end;
Here is some code we use to loop though subsets to load. You need to fill in the blanks.
Wes
DimName =' ';
vSubSet = 'N Elements';
vSubSize = subsetgetsize(DimName,vSubSet);
vSubsetCount = 1;
#***** Limits loop to subset size
While (vSubsetCount <= vSubSize);
#*****Retrieves element number 1 - n
vDimElement=SubsetGetElementName(DimName, vSubSet, vSubsetcount);
vLoadAmt=Cellgetn( )*Value;
#Loads the calculated amount from above!
CellPutN( );
#Continue Looping
vSubsetCount = vSubsetCount + 1;
end;
-
- MVP
- Posts: 3223
- 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 values
Hi
The usual approach is this:
Wim
The usual approach is this:
- - create a view on your cube (manually). Lay out the dimensions in the view in the order of the dimensions in this cube (this makes your work easier in the TI process). Save the view.
- - start a new TI process, set the view you saved as the Data source. Your variables should be correct now. (see the Variables tab). You have 1 extra variable: it's called Value
- - In the Prolog tab, put your code to create the view. Create the view with the same name you used earlier. Do NOT do a ViewZeroOut.
- - In the Data tab, write the CELLPUTN(Value, 'CUBENAME', ELEMENT NAMES) statement. The element names are simply the names of the variables in the process. By default, these are the same as the dimension names.
- - In the Epilog tab, put your code to delete the the temporary view and the temporary subsets.
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
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