Create Subsets in TI

Post Reply
Beast
Posts: 20
Joined: Thu May 13, 2010 4:58 pm
OLAP Product: TM1
Version: 9.5
Excel Version: 2007

Create Subsets in TI

Post by Beast »

I have a product dimension is has many thousands of elements. To use the cascaded picklists functionality I have to of course create subsets.I can 'manually' create them using TI by adding

SubsetCreate('Products','ProductGroup1');
SubsetCreate('Products','ProductGroup2'); etc etc etc to the Prolog tab

and

SubsetElementInsert('Products',ProductType,Products,0); to the Metadata tab

This seems to work fine but ........

I have many hundreds of product groupsand so want to avoid manually amending the ti script text every time i hear of a new product group. Is there any way I can make the subset creation dynamic and with no manual intervention ?

Any thoughts ?

Cheers.
lotsaram
MVP
Posts: 3654
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Create Subsets in TI

Post by lotsaram »

By using some attributes in your product dimension for product group and maybe also creating a separate product group dimension that is a summarised version of product dimension I don't see why this could not be entirely automated. You have all the tools you need.
Beast
Posts: 20
Joined: Thu May 13, 2010 4:58 pm
OLAP Product: TM1
Version: 9.5
Excel Version: 2007

Re: Create Subsets in TI

Post by Beast »

Thanks lotsaram appreciated. Might have all the tools in my toolbag but I'm obviously trying to fix a broken pipe with a spade :D

Now I'm trying something along the lines of

SubsetCreate('Products',ATTRS('Product'',!Products,ProductGroup);

Am on the right lines ?
User avatar
Martin Ryan
Site Admin
Posts: 1988
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: Create Subsets in TI

Post by Martin Ryan »

Not really, no :) Here's a quick step by step guide

1) Create an attribute called 'MySubset' in the dimension, say it's "CostCentre"
2) Populate some of the elements with a 1 against the 'MySubset' attribute
3) Create a TI process and set the source to be the "CostCentre" dimension you are working with
4) In the Parameters section of the Advanced tab create two parameters "pSubsetName" and "pAttrToUse"
5) In the Prolog tab write this code

Code: Select all

sDim='CostCentre';
if(subsetexists(sDim, pSubsetName)=1);
  SubsetDestroy(sDim, pSubsetName);
endif;
SubsetCreate(sDim, pSubsetName);
6) In the Data tab write this code

Code: Select all

if(attrn(sDim, elem, pAttrToUse)=1);
  SubsetElementInsert(sDim, pSubsetName, elem, 1);
endif;
# where elem is whatever variable name you gave in the variable tab of the TI process
That's all from memory, so you might need to check syntax, but it gives you the idea. You can then create attributes as you wish and add and remove elements using that attribute flag.

HTH,
Martin
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
Post Reply